Using DB2 LUW v9.7, I have a table where the primary key is an identity column, generated by DEFAULT NO CYCLE . COL1 is the key, COL2, COL3 and COL4 are the remaining columns. An index is created on COL1. No other index exists.
But I can't insert data into it.
I write the insert like this, skipping the first column so DB2 will pick the value:
insert into mytable (col2, col3, col4) values (1,6,'some_text')"
...and I get this:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the
primary key, unique constraint or unique index identified by "1" constrains table "MYSCHEMA.MYTABLE" from having duplicate values for the index key.
SQLSTATE=23505
What am I doing wrong???
Thanks,
George