DB_FetchNext Function

Action

Retrieves the next row from the database. If this is the first DB_FetchNext call after DB_ExecuteSql, this function retrieves the first row. The retrieved row becomes the current row.

Syntax

status = DB_FetchNext (hstmnt, ...)
Variable Description
status

Returns FALSE when there are no more rows. If the specified handle, hstmnt, is invalid, the function returns FALSE and an error. BOOLEAN.

hstmnt

The returned handle to the executed SQL statement. This is an input parameter for other DBTester functions, for example DB_FetchNext. HSQL.

...

A list of output arguments representing the columns of the database row. Supply a variable of the type of each column in the row in sequential order. If the supplied arguments do not match the data types of the corresponding database fields, the function returns a type mismatch error.

The list is of variable length. This means you can specify the first n columns of the row instead of supplying variables for the entire row. The output variables are filled starting with the first column in the row and continuing sequentially through the row until the function runs out of variables. Alternatively, you can specify a single list variable. Since the list length is dynamic, you will receive all the columns of the row. Likewise, you may specify a record variable that may or may not have fields for all the columns.

Notes

When you receive a valid statement handle from a DB_ExecuteSql function that specified a Select SQL command, you can issue DB_FetchPrev calls, if the database supports these, until you perform a DB_FinishSql function for that statement handle and thereby delete the handle.

Example

[ ] INTEGER index
[ ] STRING category
[-] while (DB_FetchNext (hstmnt, index, category) == TRUE) {
	[ ] // Store values in array ...  
[-] }