信息
由于可能的数据丢失,AS400 向您发出警告(查询消息),要求您取消或忽略请求的操作。因此,由于这是一个交互式请求,因此您无法通过 JDBC/ODBC 键入“I”来忽略,并且 AS 会向您抛出 ErrorCode: -952 with SQLState: 57014 和 Reason code 10。
在SQL0952的文档中说:
Message Text: Processing of the SQL statement ended. Reason code &1.
Cause Text: The SQL operation was ended before normal completion. The reason code is &1. Reason codes and their meanings are:
* 1 - An SQLCancel API request has been processed, for example from ODBC.
* 2 - SQL processing was ended by sending an exception.
* 3 - Abnormal termination.
* 4 - Activation group termination.
* 5 - Reclaim activation group or reclaim resources.
* 6 - Process termination.
* 7 - An EXIT function was called.
* 8 - Unhandled exception.
* 9 - A Long Jump was processed.
* 10 - A cancel reply to an inquiry message was received.
* 11 - Open Database File Exit Program (QIBM_QDB_OPEN).
* 0 - Unknown cause.
如果您正在使用 JDBC 并且 SQL 错误不是不言自明的,您可以使用参数“ errors=full ”建立 JDBC 连接,这将提供有关错误的更多信息。有关其他连接参数,请参见此处。
示例连接字符串:
jdbc:as400://serverName;libraries=*libl;naming=system; 错误=满;
通过该连接,产生的错误将如下所示:
Error: [SQL0952] Processing of the SQL statement ended. Reason code 10.
Cause . . . . . : The SQL operation was ended before normal completion.
The reason code is 10.
Reason codes and their meanings are:
1 -- An SQLCancel API request has been processed, for example from ODBC.
2 -- SQL processing was ended by sending an exception.
3 -- Abnormal termination.
4 -- Activation group termination.
5 -- Reclaim activation group or reclaim resources.
6 -- Process termination.
7 -- An EXIT function was called.
8 -- Unhandled exception.
9 -- A Long Jump was processed.
10 -- A cancel reply to an inquiry message was received.
11 -- Open Database File Exit Program (QIBM_QDB_OPEN).
0 -- Unknown cause.
Recovery . . . : If the reason code is 1, a client request was made to cancel SQL processing. For all other reason codes, see previous messages to determine why SQL processing was ended.
SQLState: 57014
ErrorCode: -952
解决方案
最后,如果您不能使用 STRSQL,另一种解决方案是使用 iSeries Navigator,确切地说是它的“运行 SQL 脚本”(通常在这里 --> "%Program Files%\IBM\Client Access\Shared\cwbundbs.exe ”)。
但首先你必须添加一个系统回复参数(每台机器只有一次)
ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY('I')
这是在“绿屏”中完成的。这会在 CPA32B2 查询消息上设置默认答案 ('I')。CPA32B2 是一个内部消息 ID,它与下降列操作相关联。
(实际上不必在“绿屏”中完成,像 CHGJOB 命令一样使用它。示例:
cl: ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY('I');
)
现在您可以启动“运行 SQL 脚本”,运行的第一个命令是:
cl: CHGJOB INQMSGRPY(*SYSRPYL);
这会将当前作业参数INQMSGRPY更改为 *SYSRPYL。*SYSRPYL 导致在应显示查询消息时查看是否存在系统回复参数。
现在您可以运行您的 alter 删除列。
不幸的是,我不知道如何删除一列,只使用 JDBC。如果有人知道,请告诉我。
参考: