Cursors and Temporal Queries | Temporal Table Support | Teradata Vantage - 17.05 - Cursors and Temporal Queries - Teradata Database

Teradata Vantage™ - Temporal Table Support

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1182-170K

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.