*HELP* DYNAMIC SQL in PL/SQL, IS POSSIBLE ???

From: Victor Rajendra Kumar Addepalli <victor_at_hermes.cs.uh.edu>
Date: 1995/06/29
Message-ID: <3st29u$3ve_at_masala.cc.uh.edu>#1/1


Hello There !

I am trying to do DYNAMIC SQL in PL/SQL and having trouble. I tried to pass table name string to the SQL statement in the PL/SQL block or procedure and it does not work. I tried to pass column names to the SQL statements and it works. Is there any restriction in PL/SQL that you cannot bind the table names ??

My PL/SQL block given below works:



declare
 my_column varchar2(25);
 my_value varchar2(25);
begin
 my_column := 'foo';

 select decode(my_column,'foo',foo) into my_value  from foobar;
end;
/

But I tried to bind a table name in the PL/SQL below, I get error messages.



variable my_table varchar2(25);
declare
 my_value varchar2(25);
begin
 :my_table := 'foobar';

 select foo into my_value
 from :my_table;
end;
/

These above example are used to illustrate the problem. Sincerely appreciate for any insight if you have come across such a situation. Thanks.

Victor Addepalli
email: victor_at_cs.uh.edu

       vaddepa_at_heron.mnet.uswest.com

-- 
=========================================================================

| Victor Addepalli : Dept. of Comp. Sc., Univ. of Houston |
| e-mail : victor_at_cs.uh.edu : University Park, Houston, TX - 77204 |
| US-mail: 4371 Faculty Lane, Houston, TX - 77004 |
Received on Thu Jun 29 1995 - 00:00:00 CEST

Original text of this message