ALLOCATE_UNIQUE procedure - Allocates unique lock handle for specified lock name

The ALLOCATE_UNIQUE procedure allocates a unique lock handle for the specified lock name.

Description

The ALLOCATE_UNIQUE procedure creates a 10-digit handle for the requested lock name. This handle identifies the lock in your applications when other routines in this module are invoked. The handle is associated to the lock name for the specified expiration time. If the lock handle is not expired, different sessions that invoke ALLOCATE_UNIQUE by using the same lock name receive the same lock handle.

The size of the generated handle is in the range of 1073741824 - 1999999999.

Syntax

Read syntax diagramSkip visual syntax diagram DBMS_LOCK.ALLOCATE_UNIQUE ( lockname , lockhandle ) , expiration_secs

Parameters

lockname
An expression that returns a VARCHAR(255) that specifies the lock name.
lockhandle
An expression that returns a VARCHAR(255) that specifies the lock handle.
expiration_secs
An expression that returns a DECIMAL(6) value that defines the duration in seconds of how long the lock handle is kept associated to the specified lock name. The default duration is 864000 seconds (10 days).

Authorization

EXECUTE privilege on the DBMS_LOCK module.

Example

CALL DBMS_LOCK.ALLOCATE_UNIQUE ('DEVICE1',?,1234)

Value of output parameters

Parameter Name : LOCKHANDLE Parameter Value : 1073741825

Return Status = 0