Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> PL/SQL - Use bind variable in "from <table>" query
Hello,
I have a lookup table with a column.
This column holds a variable - the name of another table.
In PL/SQL code, I need to query (at run time) the lookup table, retrieve the value stored in the lookup table's column and use it as the table in another query.
I have tried using bind variables but it seems that I cannot set the <table> in:
select * from <table>
to a bind variable.
The code:
v_table_name varchar2
v_value varchar2
begin
select table_name into v_table_name from lookup_table;
select value into v_value from :v_table_name;
end;
does not even compile. I get an error that :v_table_name is a bad bind variable.
Thanks for any help.
--
Lyndon Tiu
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 01 2005 - 00:07:43 CST
![]() |
![]() |