rowid for update

A colleague told me that select ... for update is not as good as select a.*, a.rowid from t, because the former may lock the table, and the latter will not lock the table;

 

1. Using ROWID to locate records in ORACLE is the fastest, faster than indexing, so if you first use SELECT ROWID to select the row to be updated, put it in COLLECTION, and then use FORALL UPDATE to batch update can improve the speed. From this point of view, it is better than other methods.

2. SELECT FOR UPDATE will lock records before updating, which is necessary in complex parallel query update programs, such as requiring data consistency and not allowing others to change when filtering data Data will be locked with FOR UPDATE or SET TRANSACTION READ ONLY. In addition, the WHERE CURRENT OF CURSOR statement in CURSOR requires that FOR UPDATE must be added to the SELECT.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326987469&siteId=291194637