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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing column names to Procedure as Parameter

Status
Not open for further replies.

JawwadLone

Programmer
Mar 17, 2004
57
PK
Hi everyone,
I am trying to build a dynamic query in a procedure. I want to pass the column names to the query form the front end in one parameter and table name in the second parameter field. I am writting this code

Code:
p_query varchar2 :='TEST_ID,TEST_NAME';
p_table varchar2 :='TEST'
begin
  Select "p_query" From "p_table";
end;

and receive following error

SP2-0734: unknown command beginning "p_query va..." - rest of line ignored.
SP2-0734: unknown command beginning "p_table va..." - rest of line ignored.
Select "p_query" From "p_table";
*
ERROR at line 2:
ORA-06550: line 2, column 25:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 2, column 3:
PL/SQL: SQL Statement ignored


I don't know exactly how to use these parameters in my select query.

Regards,
Jawwad Lone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top