Rexx/SQL

A Rexx interface to SQL databases

Version 2.5

10 October 2006


SQLFETCH(statement name,[number rows])

Fetches the next row (or rows) for the nominated statement. There must be an open cursor for the named statement. If the optional number rows is not specified, a single row fetch is carried out, otherwise a multi row fetch is carried out.

For single row fetches, a compound variable is created for each column name identified in the sql statement parsed in the SQLPREPARE call, with the stem being statement name and the tail corresponding to the column name.

For multi row fetches, a Rexx array is created for each column name in the sql statement parsed in the SQLPREPARE call. See SQLCOMMAND for a full description of the format of the variables. Variable tails always start with 1.

Arguments:

statement name
A name to identify the sql statement.

number rows
An optional number specifying how many rows are to be fetched.

Returns:
success: a number >= zero.
a value of zero indicates no more rows are available to be fetched.

for single row fetches, a value > zero represents the row number of the row just fetched.

for multi row fetches, a value > zero indicates the number of rows fetched. Normally this value equals number rows. If this value is less than number rows, no more rows are available to be fetched. This value can never be greater than number rows. The variable SQLCA.ROWCOUNT is set to the value returned.

failure: a negative number

Copyright © Mark Hessling 1997-2006 <mark@rexx.org>


Return to Table of Contents
Last updated 10 October 2006