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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing an arg. to a cursor

Re: Passing an arg. to a cursor

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 01 Dec 1999 20:05:16 +0800
Message-ID: <38450EFC.AC6@yahoo.com>


Douglas Nichols wrote:
>
> I want to pass the name of a field in a table to a cursor then do a
> select and other things to that column.
>
> something like:
> I have a table MYTABLE with fields (A number, B NUMBER, C NUMBER);
>
> procedure hello(myvar IN VARCHAR2)
> IS
> CURSOR getme IS (select myvar from MYTABLE);
> BEGIN
> do something here...
> END;
>
> hello('C');
> hello('A');
> ...
>
> Thanks for your input.
> --
> Cheers, dn
>
> Douglas Nichols dnichols_at_fhcrc.org
> ---------------------------------------------------------------
> National Wilms Tumor Study Group 206.667.4283
> Seattle, WA

You need dynamic SQL for this:

Check out DBMS_SQL in 8.0 and below and execute_immediate for 8i

HTH
--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Wed Dec 01 1999 - 06:05:16 CST

Original text of this message

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