ALLBASE/SQL Reference Manual (36216-90216)

Chapter 11 425
SQL Statements E - R
FETCH
variable declarations only.
DESCRIPTOR The DESCRIPTOR identifier defines where to place rows selected in
accord with a dynamically preprocessed SELECT or EXECUTE PROCEDURE
statement that has been described by a DESCRIBE statement. For a select
cursor, specify the same location (SQLDA, area name, or host variable) as
you specified in the DESCRIBE statement. For a procedure cursor, specify
the same location you specified in the ADVANCE statement or DESCRIBE
RESULT statement (for a procedure created WITH RESULT).
SQLDA specifies that a data structure of sqlda_type named sqlda is to be used to
pass information about the prepared statement between the application
and ALLBASE/SQL.
AreaName
specifies the user defined name of a data structure of sqlda_type that is to
be used to pass information about the prepared statement between the
application and ALLBASE/SQL.
SQL Syntax — BULK HostVariableSpecification
:
Buffer
[,:
StartIndex
[,:
NumberOfRows
]]
Parameters — BULK HostVariableSpecification
Buffer
is a host array structure that is to receive the output of the FETCH
statement. This structure contains fields for each column in the active set
and indicator variables for columns that contain null values. Whenever a
column can contain nulls, an indicator variable must be included in the
structure definition immediately after the definition of that column. The
indicator variable can receive the following integer values after a FETCH:
0 meaning the column's value is not null
1 meaning the column's value is null
>0 meaning the column's value is truncated (for CHAR,
VARCHAR, BINARY, and VARBINARY columns)
StartIndex
is a host variable whose value specifies the array subscript denoting where
the first row fetched should be stored; default is the first element of the
array.
NumberOfRows
is a host variable whose value specifies the maximum number of rows to
fetch; default is to fill from the starting index to the end of the array.
The total number of rows fetched is returned in the SQLERRD field of the
SQLCA. You should check this area in case the number of rows returned is
less than the maximum number of rows so that you don't process an
incomplete result.
SQL Syntax — non-BULK HostVariableSpecification
{:
HostVariable
[[INDICATOR] :
Indicator
] } [,...]