15.10 - LOCKING Clause - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

For more information about the LOCKING clause, see SQL Data Manipulation Language, B035-1146.

LOCKING

The type of lock to be placed on a database, table, view, or row hash. This setting will override any default lock placed on that object by the system. See the CREATE VIEW REPLACE VIEW topic “Views and the LOCKING Request Modifier” in SQL Data Definition Language - Detailed Topics, B035-1184 and SQL Data Manipulation Language, B035-1146.

DATABASE

A lock is to be placed at the database level for this view definition.

database_name
user_name
Name of the database or user that is to be locked for this view definition.

TABLE

Specifies that a lock is to be placed at the table level for this view definition.

table_name
Name of a user base table to be locked for this view definition.
database_name
user_name
Name of the containing database or user for table_name if other than the current database or user.

VIEW

Specifies that a lock is to be placed at the view level for this view definition.

view_name
Name of a view to be locked for this view definition.
database_name
user_name
Name of the containing database or user for view_name if something other than the current database or user.

ROW

Specifies that a lock is to be placed at the row hash level for this view definition.

FOR
IN
An optional keyword that introduces the type of lock to be placed.

lock type

The type of lock to be placed when accessing base tables through this view.

ACCESS
READ
WRITE
EXCLUSIVE
LOAD COMMITTED
The type of lock to place.

MODE

An optional keyword.

NOWAIT

Specifies that if the indicated lock cannot be obtained, the request using this view should be aborted.

This option can prevent a situation where a request is waiting for resources, possibly tying up other resources in the process of waiting for a lock to become available.