Traditional application development languages cannot deal with result tables without some kind of intermediary mechanism because SQL is a set-oriented language. The intermediary mechanism is the cursor.
A cursor is a pointer that the application program uses to move through a result table.
You declare a cursor for a SELECT request, and then open the named cursor. The act of opening the cursor executes the SQL request.
You use the FETCH... INTO... statement to individually fetch and write the rows into host variables. The application can then use the host variables to do computations.
Teradata Preprocessor2 uses cursors to mark or tag the first row accessed by an SQL query. Preprocessor2 then increments the cursor as needed.
SQL stored procedures use:
For more information on the topics presented in this chapter, see the following Teradata Database books.
If you want to learn more about… |
See… |
SQL |
SQL Fundamentals |
Types of SQL Statements |
|
The SELECT Statement |
|
SQL Data Types |
SQL Data Types and Literals |
Teradata Database Recursive Query |
SQL Fundamentals |
SQL Functions |
SQL Functions, Operators, Expressions, and Predicates |
Cursors |
|
Session Modes |
|