db2 SQLCODE -668 when inserting

user438159 picture user438159 · Sep 28, 2011 · Viewed 48.4k times · Source

While I was inserting data into a table (db2), I got this error:

Message: Operation not allowed for reason code "7" on 
table "ELSAG.ICGR1106".. SQLCODE=-668, SQLSTATE=57016, DRIVER=3.50.152,...

when I googled it, I found that the previous ALTER TABLE statement attempted to add a column to a table that has an edit procedure that is defined with row attribute sensitivity. No columns can be added to this table.

Is there is a way to rectify it?

Once I drop and re-create the table I can insert again.

Thanks in advance.

Answer

Alex Pakka picture Alex Pakka · Oct 1, 2013

To add to James' answer and save people time looking around, you could execute

CALL SYSPROC.ADMIN_CMD('REORG TABLE MY_TABLE_NAME')

via any available SQL client (i.e. even over ODBC or JDBC connection) to rectify this problem. However, the connection has to be in autocommit mode and you have to have admin privileges to execute this command.

I highly recommend to read the documentation on REORG before calling it.