Re: plsql err

  • From: Gints Plivna <gints.plivna@xxxxxxxxx>
  • To: gkatteri@xxxxxxxxxxx
  • Date: Wed, 25 Jan 2006 00:14:37 +0200

table name cannot be aused in such way i.e. as bind variable.
Here is link I'v already sent privately, but it seems it would'n hurt
also to public :)
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:227413938857

here is also code snippet:

00:10:57 gints@> create table a1(a number);

Table created.

Elapsed: 00:00:00.07
00:11:19 gints@> declare
00:11:42   2    tb varchar2(2) := 'a1';
00:11:42   3    nm number := 1;
00:11:42   4  begin
00:11:42   5    execute immediate 'insert into :a values (:b)' using tb, nm;
00:11:42   6  end;
00:11:43   7  /
declare
*
ERROR at line 1:
ORA-00903: invalid table name
ORA-06512: at line 5


Elapsed: 00:00:00.01
00:11:44 gints@> ed
Wrote file afiedt.buf

  1  declare
  2    tb varchar2(2) := 'a1';
  3    nm number := 1;
  4  begin
  5    execute immediate 'insert into a1 values (:b)' using nm;
  6* end;
00:11:59 gints@> /

PL/SQL procedure successfully completed.


Gints


On 1/24/06, GovindanK <gkatteri@xxxxxxxxxxx> wrote:
> You would generate sql commands on the fly ; Subsequently you can do
> either of the following:
> 1. Either spool them out and run them separately
> 2. Store them in a varchar2 variable and execute the string
> 3. Execute immediate .. update :tname set :cname = :value using parm1 ,
> parm2 , parm3.
>
> HTH
>
> GovindanK
> Certified DBA
>
--
//www.freelists.org/webpage/oracle-l


Other related posts: