Fetching Rows with a DSQL Cursor
Go Up to Selecting Multiple Rows in DSQL
DSQL uses the FETCH statement to retrieve rows from a results table. The rows are retrieved according to specifications provided in a previously established and populated extended SQL descriptor area (XSQLDA) that describes the user’s request. The syntax for the DSQL FETCH statement is:
FETCH cursorname USING DESCRIPTOR descriptorname;
For example, the following C code fragment declares XSQLDA structures for input and output, and illustrates how the output structure is used in a FETCH statement:
. . . XSQLDA *InputSqlda, *OutputSqlda; . . . EXEC SQL FETCH C USING DESCRIPTOR OutputSqlda; . . .
For more information about creating and filling XSQLDA structures, and preparing DSQL queries with PREPARE, see Using Dynamic SQL.