The RELEASE subprogram explicitly releases a lock obtained by using the REQUEST function. At present, you cannot use the RELEASE subprogram to release a lock when release_on_commit is set to TRUE.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
Syntax
DBMS_LOCK.RELEASE (
id IN INTEGER)
RETURN INTEGER;
DBMS_LOCK.RELEASE (
lockhandle IN VARCHAR2)
RETURN INTEGER;
Parameters
| Parameter | Description |
|---|---|
| id or lockhandle | The lock ID or lock handle. |
Return values
The RELEASE subprogram will return an integer to indicate the operation result. 0 indicates that the lock is successfully released. For other return values, see the following table.
| Return value | Description |
|---|---|
| 0 | The lock is successfully released. |
| 3 | The specified parameter is invalid. |
| 4 | The lock with the specified ID or lock handle is not owned by the current user. |
| 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)