Positioned UPDATE/DELETE
Using positioned updates/deletes with named database cursors.
The "WHERE CURRENT OF cursor-name
" clause
in UPDATE
and DELETE
statements
is not supported by all database engines.
Database Server Type | WHERE CURRENT OF support |
---|---|
IBM® DB2® LUW | Yes, see details |
IBM Informix® | Yes, see details |
IBM Netezza | No, see details |
Microsoft™ SQL Server | Yes, see details |
Oracle® MySQL / MariadDB | No, see details |
Oracle Database Server | Emulated, see details |
PostgreSQL | Yes, see details |
SAP HANA® | No, see details |
SQLite | No, see details |
Some database drivers can emulate WHERE CURRENT OF
mechanisms
by using rowids, but this requires additional processing. You
should review the code to disable this option.
The standard SQL solution is to use primary keys in all tables and write
UPDATE
/ DELETE
statements with a WHERE
clause based on the primary
key:DEFINE rec RECORD
id INTEGER,
name CHAR(100)
END RECORD
BEGIN WORK
UPDATE CUSTOMER SET CUSTNAME = rec.name
WHERE CUSTID = rec.id
...
COMMIT WORK