471,306 Members | 838 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

Newbie Question about dynamic table name references

I realize that using the TYPE declaration for variables makes their definitions more dynamic, like this:

myField tablename.name%TYPE;
myRow tablename%ROWTYPE;

But I also want to be able to change the name of the table in the code.

So I want to have "tablename" above refer to a VARIABLE that contains the name of a table, so I don't have to go changing the tablename throughout the code if the table name changes.

Is there a way to do this with PL/SQL?

Mar 11 '08 #1
1 1585
8,127 Expert 4TB
For late binding you need to use dynamic SQL.


But it is better to use ref cursor or sys ref cursor for the purpose.
Mar 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

220 posts views Thread by Brandon J. Van Every | last post: by
1 post views Thread by SAN CAZIANO | last post: by
1 post views Thread by Nathan Bloomfield | last post: by
1 post views Thread by Andrew Robinson | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.