[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Passing variables to/from Begin-SQL



Great timing.  I just now had occasion to do this very thing.  The code:


begin-sql
BEGIN
   get_next_key(i_name => 'WORK_ORDER', i_key => #wo_no);;
END;;
end-sql
show #wo_no edit 000000

It works exactly how one might expect.  #wo_no ends up with the next
value form the pseudo-sequence managed by get_next_key.  My platform:

SQR/3.0.12.1/Sun/Solaris 2.4/Oracle 7.0.16/Dec 01 1995

Hope this helps,
Eric

On Tue, 9 Sep 1997, Simonian, Guy wrote:

> We can pass variables into this section, but how do we pass variables
> out?
>
> let #cust = 1                   !some say potatoe
> move 'john' to $name            !some say po-ta-toe
>                                 ! some say tomato, some say to-ma-to
>                                 !potatoe, po-ta-toe, tomato, to-ma-toe
>                                 !Let's call the whole thing off.. tralala...!
> for example to pass into;
> begin-sql
>         insert into customers (cust_num,cust_name) values (#cust,$name)
> end-sql
>
> but how do I pass data out;
>
> begin-sql
> open my_cursor;
> fetch my_cursor into $foobar
> end-sql
>
> print $foobar   !$foobar is null even though the fetch was successful
>

------------------------------------------------------------------------
Eric Eastman    | Ray Ontko & Co. | Adverbs are endangered; act quickly.
erice@ontko.com | Richmond, IN    | http://www.ontko.com/, ftp.ontko.com