Home » SQL & PL/SQL » SQL & PL/SQL » CAN I PASS A TABLE NAME AS A VARIABLE IN THE FROM CLAUSE?
CAN I PASS A TABLE NAME AS A VARIABLE IN THE FROM CLAUSE? [message #239572] Tue, 22 May 2007 12:31 Go to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
For some reason, I am trying to use a variable name containing the actual table name in the from clause and it won't allow me. I keep getting the error saying I need to declare the variable I'm using eventhough I've used it in another statement that is not the FROM clause.

Example

SELECT count(col1), sum(col2)
FROM v_table_name;

v_table_name was declared as:

v_tablename VARCHAR2(20);
v_tablename := real_table_name;

Is it not allowed to use variables in the FROM clause or am I missing something here?
Re: CAN I PASS A TABLE NAME AS A VARIABLE IN THE FROM CLAUSE? [message #239574 is a reply to message #239572] Tue, 22 May 2007 12:36 Go to previous message
BlackSwan
Messages: 25049
Registered: January 2009
Location: SoCal
Senior Member
>Is it not allowed to use variables in the FROM clause
Not allowed
Previous Topic: ORA-30926: unable to get a stable set of rows in the source tables
Next Topic: What is wrong with this package/body?
Goto Forum:
  


Current Time: Fri Dec 09 10:03:26 CST 2016

Total time taken to generate the page: 0.27153 seconds