Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic tablenames??

Status
Not open for further replies.

aljubicic

Programmer
Nov 7, 2002
82
AU
Hi All,

Is it possible to pass use a variable or constant to pass the table name in a select query??

Such as the following

DECLARE
tablename CHAR(30);

BEGIN

tablename := 'Table'
SELECT * from tablename;

END;


Or is there another way of doing querying tables dynamically??

Any help would be great

Regards
Anthony
 
I think lexical parameter can also be used :
select * from &tablename
 
Lexical parameters are processed by client applications, thus this solution is not generic (some tools are unaware of & meaning, other use completely different notations).

Regards, Dima
 
Excuse me sem but I didn't quite understand you first comment. So how would I relate it to my example??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top