Progress
SQL-89
Guide and Reference


FETCH Statement

Retrieves the next row from the retrieval set that the OPEN statement accesses.

SYNTAX
FETCH cursor-name INTO variable-list 

cursor-name

Identifies the name of the cursor defined in the DECLARE CURSOR statement.

INTO variable-list

Lists the procedure variables that receive the column values.

The variable-list consists of a comma-separated list of variable references. Each variable reference has the following syntax:

SYNTAX
variable [ [ expression [ FOR n ] ] ]
  [ [ INDICATOR ] indicator-variable
    [ [ expression [ FOR n ] ] ]
  ] 

Each indicator-variable must be an integer. If a NULL value is fetched for a field, the indicator variable is set to -1. If a character field must be truncated to fit in the variable, the indicator variable is set to the original (untruncated) length of the value. Otherwise, if the selection succeeds, it is set to 0. You cannot use indicator variables for array fields.

Each expression is an integer array subscript. To specify a subrange of an array you can specify FOR n, where n is an integer constant.

EXAMPLE

This procedure retrieves c03.

FETCH c03 INTO pname, pnum. 

NOTES

SEE ALSO

CLOSE Statement, DECLARE CURSOR Statement, DELETE FROM Statement, OPEN Statement, UPDATE Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095