Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: table name
<mike7411_at_gmail.com> wrote in message
news:1154544909.979272.310900_at_b28g2000cwb.googlegroups.com...
: Well, if you run this
:
: create or replace procedure seltest (tablename in varchar2)
: as
: begin
: select * from tablename;
: commit;
: end;
:
: you will see that it does not use the parameter. Any ideas?
:
you have a scoping issue
a pl/sql variable can be used as a 'bind variable' in an imbedded sql statement
bind variables, however, cannot occur in the from clause -- to the tablename in your code is not interpretted as the parameter 'tablename' but is an actual table named 'tablename'
you will need to user dynamic sql to specify the tablename dynamically
++ mcs Received on Wed Aug 02 2006 - 14:03:59 CDT