plsql err 2006-01-24 - By Gints Plivna
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 (See ORA-00903.ora-code.com): invalid table name ORA-06512 (See ORA-06512.ora-code.com): 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@(protected)> 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 > -- http://www.freelists.org/webpage/oracle-l
|
|