Re: Cursing over cursors!
Date: 1995/07/20
Message-ID: <N.071995.232521.78_at_amsterdam-ppp3.knoware.nl>#1/1
> 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!
>
> Any information would be appreciated. Thanks in advance!
>
> -----------------------------------+-----------------------------------------
> Steve Frampton | Phone: (613) 547-5987, ext. 312 or 331
> Computer Operator/Systems Clerk | Internet: frampton_at_admin.flarc.edu.on.ca
> Frontenac-Lennox & Addington RCSSB | DECNET: FLASSB::FRAMPTON
> -----------------------------------+-----------------------------------------
Hi Steve,
I think you should use an explicit cursor, like this:
declare
cursor c_sel_date
is
select to_date(exception_start_date,'YYMMDD')
from absence_exception_table
;
start date;
begin
open c_sel_date;
fetch c_sel_date into start;
close c_sel_date;
end;
I hope this works,
Ruud
Received on Thu Jul 20 1995 - 00:00:00 CEST