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: Cong TANG <lai-tang_at_mycity.at>
Date: Thu, 02 Dec 1999 20:26:04 +0100
Message-ID: <3846C7CC.15B46314@mycity.at>


Check the cursor syntax:

  1. Cursor without variable

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

Original text of this message

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