LOCKING Examples | SQL Statements | Teradata Vantage - 17.05 - Example: LOCKING Request Modifier - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Advanced SQL Engine
Teradata Database
Release Number
Release Date
January 2021
Content Type
Programming Reference
Publication ID
English (United States)

The following LOCKING clause can be used to select data from the employee table while it is being modified:

     LOCKING TABLE personnel.employee FOR ACCESS
     SELECT name, salary
     FROM employee
     WHERE salary < 25000 ;
The query results may:
  • Return rows whose data can be updated or deleted an instant later by a concurrent operation initiated by another user who has obtained a WRITE lock.
  • Omit rows that are undergoing a concurrent insert operation.
  • Include rows that were not permanently inserted in the base table, because a transaction inserting the new rows was aborted and the new rows were backed out.