Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements >

FETCH

Use the FETCH statement to move a cursor to a new row in the active set and to retrieve the row values from memory.

Use this statement with ESQL/C.

Syntax

Read syntax diagramSkip visual syntax diagram           (1) .-NEXT---------------------------------------.
>>-FETCH-------+--------------------------------------------+--->
               +-PRIOR--------------------------------------+
               +-PREVIOUS-----------------------------------+
               +-FIRST--------------------------------------+
               +-LAST---------------------------------------+
               +-CURRENT------------------------------------+
               |             .- +-.                         |
               +-RELATIVE--+-+----+--+-position_num_var-+-+-+
               |           |         '-position_num-----' | |
               |           '- ---position_num-------------' |
               '-ABSOLUTE--+-row_position_var-+-------------'
                           '-row_position-----'
 
      (1)
>--+--------cursor_id_var-+------------------------------------->
   '-cursor_id------------'
 
      (1)
>--+--------+-----------------------------------------------+---+-><
   |        '-USING--+-SQL DESCRIPTOR--+-' descriptor '-+-+-'   |
   |                 |                 '-descriptor_var-' |     |
   |                 '-DESCRIPTOR--sqlda_pointer----------'     |
   |       .-,------------------------------------------------. |
   |       V                                                  | |
   '-INTO----+-output_var--+------------------------------+-+-+-'
             |             '-+-INDICATOR-+--indicator_var-' |
             |               |  (1)      |                  |
             |               '-------- :-'                  |
             '-data_structure-------------------------------'
 
Notes:
  1. Informix extension

Element Description Restrictions Syntax
cursor_id Cursor to retrieve rows Must be open Identifier
cursor_id_var Host variable storing cursor_id Must be character data type Language specific
data_structure Structure as a host variable Must store fetched values Language specific
descriptor System-descriptor area Must have been allocated Quoted String
descriptor_var Host variable storing descriptor Must be allocated Language specific
indicator_var Host variable for return code if output_var can be NULL value See Using Indicator Variables. Language specific
output_var Host variable for fetched value Must store value from row Language specific
position_num Position relative to current row Value 0 fetches current row Literal Number
position_num_var Host variable ( = position_num) Value 0 fetches current row Language specific
row_position Ordinal position in active set Must be an integer >1 Literal Number
row_position_var Host variable ( = row_ position) Must be 1 or greater Language specific
sqlda_pointer Pointer to an sqlda structure Cannot begin with $ nor : See ESQL/C manual.

Usage

How the database server creates, stores, and fetches members of the active set of rows depends on whether the cursor is a sequential cursor or a scroll cursor.

In X/Open mode, if a cursor-direction value (such as NEXT or RELATIVE) is specified, a warning message is issued, indicating that the statement does not conform to X/Open standards.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]