Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Help

Re: PL/SQL Help

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/06/20
Message-ID: <961528682.20106.0.pluto.d4ee154e@news.demon.nl>#1/1

I might overlook something but stupid question what's wrong with using
SELECT name
from emp
where ( sal > 30000 )
or
( sal < 30000 and start_dt = '01-Jan-00'). One cursor and that's all.

Hth,

Sybrand Bakker, Oracle DBA

"Ethan Post" <epost1_at_my-deja.com> wrote in message news:8io9di$i2q$1_at_nnrp1.deja.com...
> Someone please provide a somewhat more elegant solution to the problem
> in the following sample code. The problem lies in the fact that the
> exact same work needs to be done on both cursors and the line "Do Some
> Work" is duplicated in the code. I would like to re-use the loop and
> somehow pass the cursor into the procedure. I played around with REF
> CURSOR and such but haven't really found what I'm looking for. For the
> moment I'm just using 1 cursor and using a union statement to tie the
> SQL together but that is not very elegant.
>
> PROCEDURE Test IS
>
> c_cursorA IS SELECT name from emp where sal > 30000;
>
> c_cursorB IS SELECT name from emp where sal < 30000
> and start_dt = '01-Jan-00'
>
> BEGIN
>
> For lv_rec in c_cursorA LOOP
> Do Some Work;
> END LOOP;
>
> For lv_rec in c_cursorB LOOP
> Do Some Work;
> END LOOP;
>
> END Test;
>
> --
> Thanks! - Ethan
> http://www.freetechnicaltraining.com
> http://www.gnumetrics.com
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Jun 20 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US