SELECT ... The syntax for the FOR UPDATE statement is as follows:
SELECT ... For UPDATE [of Column_list][wait n| Nowait][skip LOCKED];
which
The of clause is used to specify the column that is about to be updated, that is, the row of the related table that locks a particular column.
The wait clause specifies the number of seconds to wait for another user to release the lock, preventing an indefinite wait.
The advantages of using the FOR UPDATE WAIT clause are as follows:
1. Prevent indefinitely waiting for a locked line;
2. Allow more control of the lock waiting time in the application;
3. Very useful for interactive applications, as these users cannot wait for uncertainty;
4. If skip locked is used, the locked row can be crossed and the ' resource busy ' exception report raised by Wait n is not reported.
Attention:
1.for update nowait and for update will lock the result set that is being queried, unlike if another thread is modifying the data in the result set, the for update nowait does not wait for the resource, as long as it finds that some data in the result set is locked. Immediately returns the "ORA-00054 error, content is that the resource is busy, but specifies to get the resource in NOWAIT way."
The 2.OF clause, when implicated in multiple tables, has a greater effect, such as not using the column of the specified locked table, all related rows of the table are locked, and if the column to be modified is specified in the, only the rows of the tables associated with those columns will be locked.
Oracle for update row locks