![]() Previous |
![]() Next |
The SQL OPEN command activates an explicitly-declared SQL cursor. When the cursor is opened, SQL examines any OLAP DML input expressions used in the definition of the specified cursor, determines the cursor's result set, and leaves the cursor in the open state for use by SQL FETCH or SQL IMPORT. The cursor is positioned before the first row of the result set.
You use the SQL OPEN command in combination with other SQL commands to copy data from relational tables into analytic workspace objects as outlined in "Copying Relational Data into Analytic Workspace Objects".
Syntax
SQL OPEN cursor
Parameters
The name of a cursor previously declared in the same program. You cannot use ampersand substitution.
Examples
Opening a Cursor Using SQL OPEN
The following program fragment declares and opens a cursor named geolabels
.
SQL DECLARE geolabels CURSOR FOR - SELECT Store_ID, Store_Name, City FROM Stores IF SQLCODE NE 0 THEN SIGNAL dclerror 'SQLERRM' SQL OPEN geolabels IF SQLCODE NE 0 THEN SIGNAL operror 'SQLERRM'