Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing an arg. to a cursor
Check the cursor syntax:
DECLARE
CURSOR cursor_name IS
select_statement;
2. Cursor with variables
DECLARE
CURSOR cursor_name (variable1 data_type, variable2 data_type, ...) IS
select_statement;
Example:
CURSOR C (v_owner VARCHAR2) IS
SELECT table_name
FROM dba_tables
WHERE owner = v_owner;
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
Received on Thu Dec 02 1999 - 13:26:04 CST
![]() |
![]() |