db2 update 异常

时间:2023-03-09 17:31:03
db2 update   异常

报错: -错误的sql语句:update Persons SET FirstName = 'Fred' WHERE id_P = 1
com.ibm.db2.jcc.am.SqlException: Operation not allowed for reason code "7" on table "ECCOM.PERSONS".. SQLCODE=-668, SQLSTATE=57016, DRIVER=3.72.30

解决:

db2 "reorg table tabname";

原因:

之前可能是有表结构变动 用此命令重构一下 就ok了

The table is in the reorg pending state. This can occur after an ALTER TABLE statement containing a REORG-recommended operation.7
 Reorganize the table using the REORG TABLE command (note that INPLACE REORG TABLE is not allowed for a table that is in the reorg pending state).