17.05 - cursor_declaration - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1144-175K
Language
English (United States)

You can specify these options for a cursor declaration.

cursor_name
Name of the cursor.
See Teradata Vantage™ - SQL Fundamentals, B035-1141 for the rules for naming database objects.
SCROLL
SCROLL allows the cursor to scroll forward to the next row or back to the first row of the response set.
NO SCROLL
When NO SCROLL is specified or when no option is specified, the cursor can only scroll forward to the next row. NO SCROLL is the default.
See Teradata Vantage™ - SQL Stored Procedures and Embedded SQL , B035-1148 for details.
CURSOR
Keyword qualifying the cursor_name as the cursor for the statement set to follow.
See Teradata Vantage™ - SQL Stored Procedures and Embedded SQL , B035-1148 for details.
WITHOUT RETURN
Specifies that the procedure does not return a result set.
WITHOUT RETURN is the default.
WITH RETURN ONLY
A result set cursor that is returned by the procedure, but that cursor cannot be fetched.
TO CALLER
The result set from the target procedure is to be returned to either of the following:
  • the calling procedure.
  • the calling client application.
This is the default.
TO CLIENT
The result set is to be returned to the client application even if called from a nested procedure.
If more than one SQL procedure specifies TO CLIENT, then the Teradata platform returns the results in the order opened.
FOR READ ONLY
The default option and is implicit.
FOR UPDATE
Makes the cursor updatable. Update or delete operations can be performed on the cursor.
PREPARE
An SQL_statement_name is to be set up to be executed dynamically.
The PREPARE statement is valid only for result set cursors.
See Teradata Vantage™ - SQL Stored Procedures and Embedded SQL , B035-1148 for details.
SQL_string
The SQL text that is to be executed dynamically.
SQL_string must be delimited by APOSTROPHE characters.
SQL_string_variable
Name of an SQL local variable that contains the SQL text string that is to be executed dynamically.