Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

db2 luw - DB2 load fails with SQL3304N The table does not exist

I have created 2 tables in db2 11.5 LUW :

CREATE TABLE test.TABLE1(ONE INT,
TWO CHAR(10),
THREE DATE);

CREATE TABLE test.TABLE2(ONE INT,
TWO CHAR(10),
THREE DATE);

Both tables are selectable:

db2 => select * from  test.table1;

ONE         TWO        THREE
----------- ---------- ----------

  0 record(s) selected.

db2 => select * from  test.table2;

ONE         TWO        THREE
----------- ---------- ----------

  0 record(s) selected.

Trying to run load (even on empty tables):

db2 => DECLARE mycurs CURSOR FOR SELECT ONE, TWO,  THREE FROM test.table1;
DB20000I  The SQL command completed successfully.
db2 => LOAD FROM mycurs OF cursor INSERT INTO test.table2;
SQL3304N  The table does not exist.

Any ideas why it happens?

question from:https://stackoverflow.com/questions/65898879/db2-load-fails-with-sql3304n-the-table-does-not-exist

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the reason: it was the trailing semicolon.

This one fails - mind that the command ends with ;

db2 => LOAD FROM mycurs OF cursor INSERT INTO test.table2;
SQL3304N  The table does not exist.

But, this one works - mind that the command does not end with ;

db2 => LOAD FROM mycurs OF cursor INSERT INTO test.table2
SQL3501W  The table space(s) in which the table resides will not be placed in
backup pending state since forward recovery is disabled for the database.

SQL1193I  The utility is beginning to load data from the SQL statement "
select * from test.table2".
...

I am used to oracle syntax , where ; is expected in the end of any command. I guess this is not the case in db2.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...