Oracle9i Supplied PL/SQL Packages and Types Reference
Release 1 (9.0.1)

Part Number A89852-02
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

DBMS_LOCK , 3 of 6


REQUEST Function

This function requests a lock with a given mode. REQUEST is an overloaded function that accepts either a user-defined lock identifier, or the lock handle returned by the ALLOCATE_UNIQUE procedure.

Syntax

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;

The current default values, such as X_MODE and MAXWAIT, are defined in the DBMS_LOCK package specification.

Parameters

Table 23-4 REQUEST Function Parameters
Parameter  Description 
id or lockhandle
 

User assigned lock identifier, from 0 to 1073741823, or the lock handle, returned by ALLOCATE_UNIQUE, of the lock mode you want to change. 

lockmode 
 

Mode that you are requesting for the lock.

The available modes and their associated integer identifiers are listed below. The abbreviations for these locks, as they appear in the V$ views and Enterprise Manager monitors are in parentheses.

1 - null mode

2 - row share mode (ULRS)

3 - row exclusive mode (ULRX)

4 - share mode (ULS)

5 - share row exclusive mode (ULRSX)

6 - exclusive mode (ULX)

Each of these lock modes is explained in Oracle8 Concepts

timeout
 

Number of seconds to continue trying to grant the lock.

If the lock cannot be granted within this time period, then the call returns a value of 1 (timeout). 

release_on_commit
 

Set this parameter to TRUE to release the lock on commit or roll-back.

Otherwise, the lock is held until it is explicitly released or until the end of the session. 

Return Values

Table 23-5 REQUEST Function Return Values
Return Value  Description 

Success 

Timeout 

Deadlock 

Parameter error 

Already own lock specified by id or lockhandle 

Illegal lock handle 


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback