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: dynamic tablename with %rowtype

Re: dynamic tablename with %rowtype

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Mon, 12 Apr 2004 22:31:03 -0700
Message-ID: <1081834250.104945@yasure>


Sri wrote:

> how to handle a situation where i wnt a variable of type ref cursor.
>
> TYPE refCur IS REF CURSOR;
> rc refCur;
>
> myRow rc%rowtype; -- How can I make this work???
>
> The whole problem is that only on run time I am able to know the table
> on which i have to work. So I have created a Ref Cursor
>
> BEGIN
> sqlStmt := 'select * from ' || mytable; -- mytable is stored in one
> of the table in the database. depending on the parameter passed to
> the proc the table name is retrived.
>
> OPEN rc FOR sqlStmt;
> LOOP
> FETCH rc into myRow; -- ??? I want to fetch the data from the
> cursor in a rowtype of the table - mytable. how to handle this
> situation.
> ....
> ....
> END LOOP;
> END;
>
> please guide me... as to how can i make a variable of my cursor
> rowtype. i am in urgent need of a solution asap.
> thanks
>
> Sri

Go to http://tahiti.oracle.com and look up strongly typed and weakly typed ref cursors.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Apr 13 2004 - 00:31:03 CDT

Original text of this message

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