CONVERT function - Converts the lock mode of an acquired lock
The CONVERT function converts the lock mode of an acquired lock.
Syntax
Parameters
- lock_id
- An input argument of type DECIMAL(10) that specifies the user-generated ID of the lock that is requested.
- lockhandle
- An input argument of type VARCHAR(10) that specifies the handle of the lock that is requested.
- lockmode
- An input argument of type DECIMAL(1) that specifies the requested lock mode.
- timeout
- An input argument of type DECIMAL(5) that specifies how long the session waits to acquire the lock before the operation times out.
Information returned
One of the following status codes as INTEGER:
- 0 - Success
- 1 - Timeout
- 2 - Deadlock
- 3 - Parameter error
- 4 - Already owned lock specified by 'lock_id' or 'lockhandle'
- 5 - Illegal lock handle value
Authorization
EXECUTE privilege on the DBMS_LOCK module.
Example
BEGIN
DECLARE STATUS DECIMAL(1);
DECLARE HANDLE VARCHAR(128);
CALL DBMS_LOCK.ALLOCATE_UNIQUE( 'LOCK5', HANDLE );
SET STATUS = DBMS_LOCK.REQUEST( LOCKHANDLE => HANDLE, LOCKMODE =>DBMS_LOCK.X_MODE );
SET STATUS = DBMS_LOCK.CONVERT( LOCKHANDLE => HANDLE, LOCKMODE => DBMS_LOCK.NL_MODE );
CALL DBMS_OUTPUT.PUT_LINE('STATUS: '||STATUS);
END
DB20000I The SQL command completed successfully.
STATUS: 0
STATUS: 0
SELECT LOCK_ID, LOCK_MODE, FLAG FROM SYSTOOLS.DBMS_LOCK_DET
LOCK_ID LOCK_MODE FLAG
------------ --------- ----
1073741824. 6. H
1 record(s) selected.
