DELETE (Positioned Form) | Teradata Vantage - DELETE (Positioned Form) - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
vqj1592443206677.ditamap
dita:ditavalPath
vqj1592443206677.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantageā„¢

Deletes the most current fetched row from an updatable cursor invocation.

ANSI Compliance

ANSI/ISO SQL:2011-compliant.

This form is not valid in Teradata session mode.

Required Privileges

You must have the DELETE privilege on the table.

Use care when granting the privilege to delete data through a view. Data in fields that might not be known to the user is also deleted when a row is deleted through a view.

Invocation

Executable.

Stored procedures and embedded SQL.

Syntax

{ DELETE | DEL } FROM table_name WHERE CURRENT OF cursor_name

Syntax Elements

table_name
The name of the table in which the row to be deleted is found.
cursor_name
The name of the cursor to be used to position to the row to be deleted.

Usage Notes

  • The preprocessor TRANSACT or -tr option must be set to ANSI.
  • The WHERE CURRENT OF clause enables a DELETE statement to act on a row currently pointed to by the cursor named in WHERE CURRENT OF cursor_name.
  • Restrictions on Using WHERE CURRENT OF
    • cursor_name must be a valid updatable cursor.
    • Multiple updates of the current row of cursor or updates followed by a delete of the current row of cursor are allowed.
    • table_name must be the same table that you SELECT in the updatable cursor request.
    • You must position the referenced cursor at a valid row via the FETCH statement.

Example: Deleting a Row with a Cursor

In this example, the name of the cursor being used to delete from the table is X01.

EXEC SQL
DELETE FROM customer
WHERE CURRENT OF x01;

Related Information

  • Teradata Vantageā„¢ - SQL Data Manipulation Language, B035-1146