Hi,
Within the same PLSQL block I am dynamically creating a table and then attempting to BULK insert records into it from an index by table called periods. However, the insert fails to compile and the error returned is ORA-0942 indicating that the table nmltrx_0304 does not exist.However, if I run a script which dynamically creates the table and then does the inserts, respectively as two subsequent PLSQL blocks ( not nested ) then then whole thing compiles and executes successfully. This isn't a big issue but I'm very interested in finding out why this is happening. The main code fragments in the block are listed below along with the error message:
---
---
---
v_string := 'CREATE TABLE nmltrx_0304 AS
SELECT *
FROM nmltrx
WHERE 0 = 1 ' ;
---
---
---
FORALL i IN periods.FIRST .. periods.LAST
INSERT INTO nmltrx_0304 VALUES periods(i) ;
---
---
INSERT INTO nmltrx_0304 VALUES periods(i) ;
*
ERROR at line 30:
ORA-06550: line 30, column 21:
PL/SQL: ORA-00942: table or view does not exist
Within the same PLSQL block I am dynamically creating a table and then attempting to BULK insert records into it from an index by table called periods. However, the insert fails to compile and the error returned is ORA-0942 indicating that the table nmltrx_0304 does not exist.However, if I run a script which dynamically creates the table and then does the inserts, respectively as two subsequent PLSQL blocks ( not nested ) then then whole thing compiles and executes successfully. This isn't a big issue but I'm very interested in finding out why this is happening. The main code fragments in the block are listed below along with the error message:
---
---
---
v_string := 'CREATE TABLE nmltrx_0304 AS
SELECT *
FROM nmltrx
WHERE 0 = 1 ' ;
---
---
---
FORALL i IN periods.FIRST .. periods.LAST
INSERT INTO nmltrx_0304 VALUES periods(i) ;
---
---
INSERT INTO nmltrx_0304 VALUES periods(i) ;
*
ERROR at line 30:
ORA-06550: line 30, column 21:
PL/SQL: ORA-00942: table or view does not exist