WITH clause
- Last Updated: December 12, 2014
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Enables table-level locking when a finer control of the types of locks acquired on an object is required. These locking hints override the current transaction isolation level for the session.
The
locking hint clause, such as for READPAST, can only
be specified in the main SELECT statement, but
not in the subquery SELECT statement in the "search
condition" of the WHERE clause.
Syntax
|
Parameters
- search_condition
-
The
READPASTlocking hint skips locked rows. This option causes a transaction to skip rows locked by other transactions that would ordinarily appear in the result set, rather than block the transaction waiting for the other transactions to release their locks on these rows. TheREADPASTlock hint applies only to transactions operating atREAD COMMITTEDisolation and will read only past row-level locks. Applies only to theSELECTstatement.The
NOLOCKlocking hint ensures records are not locked during the execution of aSELECTstatement when the transaction isolation level is set toREAD COMMITTED. WhenNOLOCKis invoked, a dirty read is possible. This locking hint only works with theSELECTstatement. - WAIT timeout
-
Override the default lock-wait time out. The timeout value is in seconds and can be 0 or any positive number.
- NOWAIT
-
Causes the
SELECTstatement to skip (read past) the row immediately if a lock cannot be acquired on a row in the selection set because of the lock held by some other transaction. The default behavior is for the transaction to wait until it obtains the required lock or until it times out waiting for the lock.
Example
The
following example demonstrates the WITH clause in
the SELECT statement:
|