The RELEASE procedure is used to explicitly release a lock obtained using the REQUEST function. The RELEASE procedure cannot unlock locks in scenarios where release_on_commit = true.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_LOCK.RELEASE (
id IN INTEGER)
RETURN INTEGER;
DBMS_LOCK.RELEASE (
lockhandle IN VARCHAR2)
RETURN INTEGER;
Parameters
| Parameter | Description |
|---|---|
| id or lockhandle | Lock ID or Lock Handle. |
Return value
The RELEASE procedure returns an integer indicating whether the operation succeeded or failed. A return value of 0 indicates that the lock was successfully released. The following table describes the other return values.
| Return value | Description |
|---|---|
| 0 | The operation succeeded. |
| 3 | An invalid parameter was specified. |
| 4 | The lock with the specified ID or Lock Handle does not exist. |
| 5 | The Lock Handle is invalid. |
Examples
obclient> DECLARE
-> LOCKID INTEGER := 1;
-> CALL_STATUS INTEGER;
-> BEGIN
-> CALL_STATUS := DBMS_LOCK.RELEASE(LOCKID);
-> DBMS_OUTPUT.PUT_LINE(CALL_STATUS);
-> END;
-> /
Query OK, 1 row affected (0.817 sec)
