Home » SQL & PL/SQL » SQL & PL/SQL » how to specify dynamic cursorname in FETCH INTO statement
how to specify dynamic cursorname in FETCH INTO statement [message #394740] Mon, 30 March 2009 00:40 Go to next message
meghna_makadia
Messages: 4
Registered: October 2008
Junior Member
Hi there,

my pl/sql block is like below:

LOOP
FETCH pSnCur INTO <variablevalue>
EXIT WHEN pSnCur%NOTFOUND;
............

end loop;

here after INTO i want to specify variable for cursorname because my cursorname is changing dynamically. Is it possible to do this? If yes then how.

Thanks,
Meghna.
Re: how to specify dynamic cursorname in FETCH INTO statement [message #394741 is a reply to message #394740] Mon, 30 March 2009 00:42 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Re: how to specify dynamic cursorname in FETCH INTO statement [message #394744 is a reply to message #394740] Mon, 30 March 2009 00:57 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Can you elaborate a bit on what it is you want?
The name of the variable you fetch into has nothing to do with the name of the cursor, so I don't understand why you think you need to vary the name of the variable you fetch your results into.
If you still think it is necessary: PL/SQL does not know the concept of dynamic variables.
Re: how to specify dynamic cursorname in FETCH INTO statement [message #394754 is a reply to message #394740] Mon, 30 March 2009 03:12 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You cannot specify a dynamic list of variables to select into.
You can define a variable as <cursor>%rowtype, and fetch a row into that, but that would only work with static cursors and strongly typed ref cursors - I'm guessing that you're using weak ref cursors if the column list you select is changing.

One option might be to wrap the SQL for each of your dynamic cursors in an outer select that returned a standard set of columns, some of which would be blank.

If you can provide more details, such as some code, then we might be able to help more.
Previous Topic: Date Format change
Next Topic: boolean value to string
Goto Forum:
  


Current Time: Sat Dec 10 14:44:06 CST 2016

Total time taken to generate the page: 0.15214 seconds