Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Declare Cursor with Variable

Brett CalhounJun 26 2003 — edited Jun 27 2003
How do I declare a cursor using a variable for the SELECT clause? Example: the variable "tabl" contains the value of the table I wish to declare a cursor upon. The following code will not work (invalid cursor error):

declare cursor cursor_table is SELECT * from tabl;

The reason I am using the variable "tabl" is because this section of code operates inside a loop. The loop is repeated once for every record in a "driver" table. The driver table contains the names of other tables which I wish to declare (and open) the cursor upon. The variable "tabl" holds the names of these tables.

Any help is appreciated.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2003
Added on Jun 26 2003
4 comments
571 views