Tablename as parameter. How to use it in the SQL Statement in the PL/SQL Code? [message #279808] |
Sat, 10 November 2007 13:03  |
novalex
Messages: 19 Registered: November 2007
|
Junior Member |
|
|
Hello!
I tried to find an answer on this question but all examples shows something different than I'm looking for.
It's a simple problem but I cannot solve it.
I wrote this procedure:
procedure test_proc(tab_name in varchar2) as
var number;
BEGIN
SELECT count(*) into var FROM tab_name;
dbms_output.put_line(var);
NULL;
END test_proc;
The problem is that I don't know how to use the parameter tab_name in the SQL-statement? I mean when this code is executed with this SQL Statement (see above):
SELECT count(*) into var FROM tab_name;
I want to have replaced the 'tab_name' with its value (the name of the table). Instead I get an error that the table cannot be found.
All examples I found use directly tablenames on that place. 
Hope you can help me.
Thank you.
Novalex
|
|
|
|
|
|
|
|
|