SQL db2 SQLCODE -668 插入时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7578013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:15:57  来源:igfitidea点击:

db2 SQLCODE -668 when inserting

sqldb2

提问by user438159

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

当我将数据插入表 (db2) 时,出现此错误:

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.

当我用谷歌搜索它时,我发现之前的 ALTER TABLE 语句试图将一列添加到一个表中,该表具有一个用行属性敏感性定义的编辑过程。不能向该表添加任何列。

Is there is a way to rectify it?

有没有办法纠正它?

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

一旦我删除并重新创建表,我就可以再次插入。

Thanks in advance.

提前致谢。

回答by Alex Pakka

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.

通过任何可用的 SQL 客户端(即甚至通过 ODBC 或 JDBC 连接)来纠正这个问题。但是,连接必须处于自动提交模式,并且您必须具有管理员权限才能执行此命令。

I highly recommend to read the documentation on REORGbefore calling it.

我强烈建议在调用REORG之前阅读有关REORG的文档。

回答by James Anderson

According to this: SQL0668

根据这个: SQL0668

You have done some alteration to the table which requires a REORG before you can further update the table.

您已经对表进行了一些更改,这需要在进一步更新表之前进行 REORG。

Run the REORG utility against the table and you should be OK.

对表运行 REORG 实用程序,您应该没问题。

回答by Ankireddy Polu

CALL SYSPROC.ADMIN_CMD('REORG TABLE TABLE_NAME') solves the problem

CALL SYSPROC.ADMIN_CMD('REORG TABLE TABLE_NAME') 解决问题