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.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

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

Invocation

Executable.

Stored procedures and embedded SQL.

Syntax

{ DELETE | DEL } FROM table_name WHERE CURRENT OF cursor_name
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.

ANSI Compliance

ANSI/ISO SQL:2011-compliant.

This form is not valid in Teradata session mode.

Authorization

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.

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.

Rules

  • 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.

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 Topics

See “DELETE” in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.