[英]db2 SQLCODE -668 when inserting
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.当我用谷歌搜索它时,我发现之前的 ALTER TABLE 语句试图将一列添加到一个表中,该表具有一个用行属性敏感性定义的编辑过程。 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.提前致谢。
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 (ie even over ODBC or JDBC connection) to rectify this problem.通过任何可用的 SQL 客户端(即甚至通过 ODBC 或 JDBC 连接)来纠正这个问题。 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.我强烈建议在调用REORG之前阅读有关REORG的文档。
CALL SYSPROC.ADMIN_CMD('REORG TABLE TABLE_NAME') 解决问题
SELECT REORG_PENDING FROM SYSIBMADM.ADMINTABINFO where TABSCHEMA = '<schema_name>' and tabname = '<table_name>';
If above query returns Y Then run below query:如果上面的查询返回 Y 然后运行下面的查询:
call sysproc.admin_cmd('reorg table <schema_name>.<table_name>');
For more info visit: SQL0668N Operating not allowed for reason code '7'有关更多信息,请访问: SQL0668N 由于原因代码“7”而不允许操作
I turned off integrity checks on some table and got that error message afterwards when altering data.我关闭了某些表的完整性检查,然后在更改数据时收到了该错误消息。 This here generated the statements which helped:
这在这里生成了帮助:
select 'SET INTEGRITY FOR ' || rtrim(tabname) || ' IMMEDIATE CHECKED;'
from syscat.tables
where CONST_CHECKED like '%N%'
or status != 'N'
or access_mode != 'F'
with ur;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.