1
Select * From ttable1 for update
Lock all rows in the Table. Only read and write operations are allowed.
2
Select * From ttable1 where pkid = 1 for update
Only lock the row with pkid = 1
3
Select * From Table1 a join Table2 B on A. pkid = B. pkid for update
Lock all records of two tables
This statement locks all records of the two tables that match the ID, instead of locking all records of the two tables. Correct the statements. |
|
This statement locks all records of the two tables that match the ID, instead of locking all records of the two tables. Correct the statements. |
|
This statement locks all records of the two tables that match the ID, instead of locking all records of the two tables. Correct the statements. |
|
(This statement locks all records of the two tables that meet the ID matching condition, instead of locking all records of the two tables. Correct the statements)
4
Select * From Table1 a join Table2 B on A. pkid = B. pkid where a. pkid = 10 for update
Lock the rows in the two tables that meet the conditions
5.
Select * From Table1 a join Table2 B on A. pkid = B. pkid where a. pkid = 10 for update of A. pkid
Only lock rows in Table 1 that meet the conditions
Note: For update of is incorrect.
OracleIt is used to lock fields.
Http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10826/pco03dbc.htm#i4233
Restrictions
You cannot use for update with multiple tables, but you must use for update of toidentify a column in the table that you want locked. row locks obtained by a for update statement are cleared by a commit, which explains why
The cursor is closed for you. If you try to fetch from a for update cursor after a commit, Oracle generates a fetch out of sequence error.