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.
You can use a select-statement within an INSERT statement to insert zero, one, or more rows into a table from the result table of the select-statement. The select-statement embedded in the INSERT statement is no different from the select-statement you use to retrieve data.
There are no "special characters" in SQL databases (including DB2), unless they are special to the application doing the inserting. If you are using parameterized statements: INSERT INTO mytable (mycol) VALUES (?) , anything goes.
In previous examples, we either specified specific values in the INSERT INTO statement or used INSERT INTO SELECT to get records from the source table and insert it into the destination table. We can combine both columns and defined values in the SQL INSERT INTO SELECT statement.
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.
CALL SYSPROC.ADMIN_CMD('REORG TABLE TABLE_NAME') solves the problem
According to this: SQL0668
You have done some alteration to the table which requires a REORG before you can further update the table.
Run the REORG utility against the table and you should be OK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With