Skip to Main Content

SQLcl: MCP Server & SQL Prompt

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!

How to create alias with input table as parameter?

Blue BirdOct 10 2018 — edited Oct 12 2018

I'm using SQLcl 18.2.x. If I create alias with input parameter for where clause in sql statement alias work ok, but If I use parameter for table name doesn't. For example:

This working:

alias test = Select * From Emp Where DeptNo = :MyPar;

"Test 10" return appropriate records.

and this not working;

alias test2 = Select * From :MyPar;

I get error "Invalid table name" after calling "test2 Emp".

Is it possible to use parameter also for table name? I would like to create for example "disp TableName" shortcut to quickly display data from any table name I pass as parameter w/o writing everytime whole Select sentence.

Thanks,

BB

Comments
Post Details
Added on Oct 10 2018
5 comments
4,086 views