Home » SQL & PL/SQL » SQL & PL/SQL » cursor with dynamic table
cursor with dynamic table [message #395570] Wed, 01 April 2009 22:41 Go to next message
Theracersman
Messages: 28
Registered: November 2007
Location: Indonesia
Junior Member

Hi all..
i have a problem with cursor dynamic table, for example
this my script.but that script error.
how to make cursor with dynamic table?
help me...



Declare

vTable Varchar2(50) := 'TCPUR101T';
Sqlstm Varchar2(2000);

Begin

Sqlstm := 'Select * from '||vTable;

For i In (Sqlstm)
Loop
Null;
End Loop;

End;
Re: cursor with dynamic table [message #395575 is a reply to message #395570] Wed, 01 April 2009 22:46 Go to previous messageGo to next message
BlackSwan
Messages: 26766
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/


>this my script.but that script error.
ERROR? What Error? I don't see any error.

Please, please, please Read & Follow Posting Guidelines above.
Go to the section labeled "Practice" & do as directed.

I suggest you first make the code work with a hard coded value.
First make it work, then make it fancy!



[Updated on: Wed, 01 April 2009 22:54]

Report message to a moderator

Re: cursor with dynamic table [message #395608 is a reply to message #395570] Thu, 02 April 2009 01:11 Go to previous message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You have to open, fetch and close the cursor by yourself in this case.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1433

Regards
Michel
Previous Topic: Performance issue with name value pairs
Next Topic: cursors with same codes
Goto Forum:
  


Current Time: Tue Dec 10 03:34:28 CST 2024