How to Truncate table in DB2? Error: Not a valid Command Line Processor command

How to Truncate table in DB2? Error: Not a valid Command Line Processor command

运行 DB2 CLP 中的以下语句(命令 Window)

db2 "truncate table MYSCHEMA.TABLEA immediate"

DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0969N  There is no message text corresponding to SQL error "-20356" in the
message file on this workstation.  The error was returned from module
"SQLNQBE2" with original tokens "MYSCHEMA.TABLEA".

有人可以告诉我我做错了什么或者我错过了什么吗?我试图简单地从单个 table 中截断,但收到以下错误消息。不知道我做错了什么。我试过 with/without 引号,with/without 模式,with/without 立即。我也在命令编辑器中尝试过(删除 db2 和引号)但仍然无法正常工作。我在用着: DB2/AIX64 9.7.9 另外,我有删除权限,因为我可以删除记录,但我想截断。

提前致谢!

ALTER TABLE MYSCHEMA.TABLEA ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE

import from /dev/null of del replace into MYSCHEMA.TABLEA

我最近也遇到了这个问题。就我而言,我必须在 TRUNCATE 之前执行 COMMIT WORK。这解决了我的问题。请尝试告诉我们这是否有帮助。

您使用的 DB2 客户端版本似乎与服务器版本不匹配,这就是您看不到 SQLCODE -20356 的实际错误消息的原因。如果可以的话,你会看到这个:

The table MYSCHEMA.TABLEA cannot be truncated because DELETE triggers exist for the table, or the table is the parent in a referential constraint.

可以像往常一样找到进一步的解释和建议的操作,in the fine manual