关于来自 C 应用程序的 db2 CLI/ODBC 连接的 table 错误的更新?
Update on table error with db2 CLI/ODBC Connection from C Application?
从通过 DB2 CLI/ODBC 驱动程序连接的 C 应用程序更新远程数据库时出错。
UPDATE 语句 (returns -1) 的函数 SQLExecute 发生错误。
SQLSTATE:42828,本机错误代码:4294966786,[IBM][CLI 驱动程序][DB2/AIX64] SQL0510N 不允许对指定的游标进行更新或删除。 SQLSTATE=42828
谢谢,
穆罕默德沙姆沙德
编程错误。更多信息请见下方 link。
db2“?SQL0510N”
SQL0510N UPDATE or DELETE is not allowed against the specified
cursor.
Explanation:
The program attempted to execute an UPDATE or DELETE WHERE CURRENT OF
cursor statement against a table or view definition that does not
permit the requested update or delete operation. For example, this
error can occur in a delete from a read-only view or in an update
where the cursor was not defined with the FOR UPDATE clause.
来自提供的日志文件:
SQLPrepare(65537,SELECT * FROM SPAUTH WHERE TRMCAU=? AND PRFCAU=? AND
LVL2AU=? ORDER BY TRMCAU ASC, PRFCAU ASC, LVL2AU ASC OPTIMIZE FOR
40 ROWS,SQL_NTS);
SQLSetCursorName(65537, SPAUTHU);
...
SQLPrepare(65539,UPDATE SPAUTH set TRMCAU=?,PRFCAU=?,LVL2AU=?,AUTHAU=?
where current of SPAUTHU, SQL_NTS);
SQLExecute(65539);
[ERROR] 0315-152416 Process 31244 File isp406000o/qcsrc/TestUpd1.c
Line 1653 : SQLSTATE: 42828, Native Error Code: 4294966786,
[IBM][CLI Driver][DB2/AIX64] SQL0510N UPDATE or DELETE is not allowed
against the specified cursor. SQLSTATE=42828
游标 SPAUTHU 不可更新,但您尝试针对它发出定位更新。
DECLARE CURSOR statement:
A column in the select list of the outer fullselect associated with a
cursor is updatable if each of the following conditions is true:
- The cursor is deletable
...
A cursor is deletable if each of the following conditions is true:
...
- The outer fullselect does not include an ORDER BY clause (even if
the ORDER BY clause is nested in a view), and the FOR UPDATE clause
has not been specified
...
在 SELECT
语句末尾添加 FOR UPDATE
子句。
从通过 DB2 CLI/ODBC 驱动程序连接的 C 应用程序更新远程数据库时出错。
UPDATE 语句 (returns -1) 的函数 SQLExecute 发生错误。
SQLSTATE:42828,本机错误代码:4294966786,[IBM][CLI 驱动程序][DB2/AIX64] SQL0510N 不允许对指定的游标进行更新或删除。 SQLSTATE=42828
谢谢, 穆罕默德沙姆沙德
编程错误。更多信息请见下方 link。
db2“?SQL0510N”
SQL0510N UPDATE or DELETE is not allowed against the specified cursor.
Explanation:
The program attempted to execute an UPDATE or DELETE WHERE CURRENT OF cursor statement against a table or view definition that does not permit the requested update or delete operation. For example, this error can occur in a delete from a read-only view or in an update where the cursor was not defined with the FOR UPDATE clause.
来自提供的日志文件:
SQLPrepare(65537,SELECT * FROM SPAUTH WHERE TRMCAU=? AND PRFCAU=? AND LVL2AU=? ORDER BY TRMCAU ASC, PRFCAU ASC, LVL2AU ASC OPTIMIZE FOR 40 ROWS,SQL_NTS);
SQLSetCursorName(65537, SPAUTHU);
...
SQLPrepare(65539,UPDATE SPAUTH set TRMCAU=?,PRFCAU=?,LVL2AU=?,AUTHAU=? where current of SPAUTHU, SQL_NTS);
SQLExecute(65539);[ERROR] 0315-152416 Process 31244 File isp406000o/qcsrc/TestUpd1.c Line 1653 : SQLSTATE: 42828, Native Error Code: 4294966786, [IBM][CLI Driver][DB2/AIX64] SQL0510N UPDATE or DELETE is not allowed against the specified cursor. SQLSTATE=42828
游标 SPAUTHU 不可更新,但您尝试针对它发出定位更新。
DECLARE CURSOR statement:
A column in the select list of the outer fullselect associated with a cursor is updatable if each of the following conditions is true:
- The cursor is deletable
...A cursor is deletable if each of the following conditions is true:
...
- The outer fullselect does not include an ORDER BY clause (even if the ORDER BY clause is nested in a view), and the FOR UPDATE clause has not been specified
...
在 SELECT
语句末尾添加 FOR UPDATE
子句。