Cursors and Temporal Queries | Temporal Table Support | Teradata Vantage - 17.10 - Cursors and Temporal Queries - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Temporal Table Support

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

A cursor is a data structure that stored procedures and Preprocessor2 use at runtime to point to the result rows in a response set returned by an SQL query. Procedures and embedded SQL also use cursors to manage inserts, updates, execution of multistatement requests, and SQL macros.

The DML semantics described for temporal tables apply to DML associated with a cursor, with some limitations that relate to positioned (updatable) cursors:
  • Only the current form of positioned cursors is allowed. The SELECT statement specified in the iteration statement FOR, DECLARE CURSOR, and positioned DELETE and UPDATE statements must all be qualified as CURRENT.
  • A SELECT statement on a temporal table can open an updatable cursor if the statement conforms to all existing rules on updatable cursors.
  • A SELECT statement that opens an updatable cursor has the same syntax as described in SELECT/SELECT INTO (Temporal Forms) when the statement references a temporal table, but the FROM clause must not specify an AS OF clause in the transaction-time dimension.
  • A positioned DELETE must be a CURRENT delete, and must not specify an AS OF clause as part of the FROM clause.
  • A positioned UPDATE must be a CURRENT update.

Related Information

For more information on... See...
cursors Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148