FOR UPDATE WITH RS to do DB2 row locking

FOR UPDATE WITH RS to do DB2 row locking

To lock in Oracle, use FOR UPDATE.

In DB2, use FOR UPDATE WITH RS.

Here is an example

SELECT *
FROM ~
FOR UPDATE WITH RS

In the System i Navigator, the statement FOR UPDATE WITH RS will be locked.

To check for locking, right click on “Table” and select “Locked Rows” to see if rows are locked.

To release the row lock, execute ROLLBACK from “Execute SQL Script” in “Execute SQL Script”.

ROLLBACK;

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL