Calls

PROCEDURE DBMS_LOCK.ALLOCATE_UNIQUE (lockname IN VARCHAR2, lockhandle OUT VARCHAR2, expiration_secs IN INTEGER DEFAULT 864000);

Allocates a unique lockhandle for the lock identified by lockname to last for expiration_secs seconds. Also performs a COMMIT.

FUNCTION DBMS_LOCK.CONVERT ({id IN INTEGER | lockhandle IN VARCHAR2}, lockmode IN INTEGER, timeout IN NUMBER DEFAULT MAXWAIT) RETURN INTEGER;

Converts the lock identified by either id or lockhandle to the mode specified by lockmode, waiting for up to timeout seconds for successful completion. lockmode must be a valid constant as defined in the DBMS_LOCK package. Return values are 0 = success; 1 = timed out; 2 = deadlock; 3 = parameter error; 4 = do not own lock, cannot convert; or 5 = illegal lockhandle.

FUNCTION DBMS_LOCK.RELEASE ({id IN INTEGER | lockhandle IN VARCHAR2}) RETURN INTEGER;

Releases the lock identified by either id or lockhandle. Return values are the same as for the CONVERT function.

FUNCTION DBMS_LOCK.REQUEST ({id IN INTEGER | lockhandle IN VARCHAR2}, lockmode IN INTEGER DEFAULT X_MODE, timeout IN INTEGER DEFAULT MAXWAIT, release_on_commit IN BOOLEAN DEFAULT FALSE) RETURN INTEGER;

Acquires the lock identified by either id or lockhandle in the mode specified by lockmode, waiting for up to timeout seconds for successful completion. When release_on_commit is TRUE, the lock is automatically released as the result of the transaction COMMIT or ROLLBACK. lockmode must be a valid constant as defined in the DBMS_LOCK ...

Get Oracle in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.