Syntax Elements - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

Locking Object

DATABASE
Optional keyword to indicate the type of object to lock is a database.
database_name
Name of the database or user to be locked.
TABLE
Optional keyword to indicate the type of object to lock is a table.
table_name
Name of the base table to be locked.
VIEW
Optional keyword to indicate the type of object to lock is a view.
view_name
Name of the view to be locked.
ROW
Optional keyword specifying rowhash or rowkey level for locking in accordance with the defining statement. See Using LOCKING ROW.

Lock Type

You can specify the following lock severities. For additional information about locking, see “Locking and Transaction Processing” in Teradata Vantage™ SQL Request and Transaction Processing, B035-1142.

FOR
IN
Introduction to the type of lock to be placed.
ACCESS
Permits selection of data from a base table that can be locked for write access by other users.
The data selected using an ACCESS lock can be inconsistent because the data may be modified concurrently with the request. Therefore, you should only use this lock for casual inspection of data.
Placing an ACCESS lock requires the SELECT privilege on the specified object.
EXCLUSIVE
Excludes all other users.
This is the most restrictive lock.
EXCLUSIVE locks are rarely used except to make structural changes to a database.
Placing an EXCLUSIVE lock on a database object requires the DROP privilege on that object.
READ
SHARE
Ensures data consistency during a read operation such as a SELECT request.
Multiple users can concurrently hold a READ lock on a base table. As long as a READ lock is in place, no modification of the object is allowed.
Placing a READ lock requires the SELECT privilege on the specified object.
SHARE is a deprecated synonym for READ.
WRITE
Enables a single user to modify data.
As long as the WRITE lock is in place, all other users are excluded from viewing or modifying the object except readers who are viewing data using an ACCESS lock.
Until a WRITE lock is released, no new READ locks are permitted on the locked object.
Placing a WRITE lock requires an UPDATE, INSERT, or DELETE privilege on the specified object.
CHECKSUM
Used only for updatable cursor queries submitted outside of stored procedures.
OVERRIDE
Permit a READ lock for a single-table SELECT operation when a rollback on an underlying base table in the query was canceled using the Recovery Manager utility CANCEL ROLLBACK ON TABLE command. For more information, see Teradata Vantage™ - Database Utilities , B035-1102 .
You can only specify the OVERRIDE option with a READ lock request.
LOAD COMMITTED
Load-committed read mode. This option is independent of the session transaction isolation level.
Permits selection of committed data from a base load isolated table that can be locked for write access by other transactions.
Placing an LOAD COMMITTED lock requires the SELECT privilege on the specified object.
Internally, an ACCESS lock is applied when load-committed read mode is specified.
MODE
Optional keyword following the lock type.

Do Not Wait Option

NOWAIT
If the indicated lock cannot be obtained, the request should be aborted.
Specify this option for situations in which it is not desirable to have a request wait for resources, and possibly tie up resources another request could use, while waiting.

SQL Request

SQL_request
A valid SQL request.
You cannot specify LOCKING with the CALL statement.
If SQL_request is null, then the only effect of LOCK is to lock the specified object.
This specification is mandatory for row-level locking (rowhash or rowkey), but optional for database-level locking, base table-level locking, and view-level locking.