Script functions reference > Script functions in alphabetical order > O > OdbcGetNext

OdbcGetNext
Syntax
OdbcGetNext(str_dbidentifier, var_1[, var_2, var_n]);
str_dbidentifier 
var_n
Description
Retrieves the values of the columns in the second row of a result set. This function can only be called after OdbcGetFirst has been called to retrieve the first row in the result set. OdbcGetNext can then be called repeatedly to process all the remaining rows. When all the rows have been processed, no data will be found and OdbcGetNext will return 0 (zero).
The value of the first column of the result set will be copied to the first variable in the list of variables. The second column will be copied to the second variable and so on.
If the number of variables is less than the number of columns in the result set, the last columns that do not have matching variables will be ignored.
If the number of columns in the result set is less than the number of variables, the last variables that do not have matching columns will be cleared.
If the result set from the SQL statement is empty, all variables will be cleared.
Returns
1
0
-1
Example
$st="SELECT CUSTNAME FROM CUSTOMER WHERE CITY='Gothenburg';";
$ret=OdbcGetFirst("my_identifier",$st,$custname);
 
while(Num($ret)>0){
callblock("customer");
$ret=OdbcGetNext("my_identifier",$custname);
}
The CUSTNAME column is retrieved for all customers that have the CITY column set to Gothenburg in the CUSTOMER table.
The callblock function is a StreamServe scripting function. It is used to call a free block. In this example, a free block with the name "customer" will be called for each retrieved customer.
OpenText StreamServe 5.6 Updated: 2013-03-01