Re: Cursing over cursors!
Date: 1995/07/19
Message-ID: <1995Jul19.075425.4188_at_molene.ifremer.fr>#1/1
In article <3ugs04$ai3_at_knot.queensu.ca>, 3srf_at_qlink.queensu.ca (Frampton Steve R) says:
>
>Hello:
>
>I'm new to PL/SQL, and am having a little difficulty with cursors. Now
>that I finally understand them, I need a little help writing one.
>
>I want to do calculations in my select statement inside the cursor, and
>have the results placed in my target variables. In straight PL/SQL,
>I would have something like:
>
>select to_date(exception_start_date,'YYMMDD')
>into start
>from absence_exception_table;
>
>Of course, you can't do an "INTO" in cursors. I've also tried:
>
>select to_date(exception_start_date,'YYMMDD') start
>from absence_exception_table;
>
>...but I got an error for this too.
>
>What is the proper way of doing this? I've only got access to Oracle's
>PL/SQL User's Guide & Reference, and this manual is worse than the
>famous cruddy manuals for Borland products!
Hi,
I'm not sure that you really understand cursors. Maybe you'd write something like this :
declare
cursor c1 is select to_date(exception_start_date,'YYMMDD')
from absence_exception_table;w_date date;
/* Don't use start it's a reserved word (look at appendix E in your manual)*/ begin
open c1;
loop
fetch c1 into w_date; exit when c1%notfound; ... [your work] ...
end loop;
close c1;
end;
Hope this help,
Eric. Received on Wed Jul 19 1995 - 00:00:00 CEST