SQL_FETCH_COLUMN¶
Applies to: ORAFlex SQLFlex MYSQLFlex PGFlex DB2Flex
This command is used to retrieve a specified column from a result set of an SQL statement. Note that this command cannot be used to replace SQL_FETCH_NEXT_ROW but is used in addition to it when only one column is needed. For most cases, SQL_FETCH_NEXT_ROW can be used alone to retrieve the columns desired so this should only be used if there is a specific reason to do so.
Syntax
SQL_FETCH_COLUMN {columnNumber} into {variable}
Parameter |
Description |
---|---|
columnNumber |
Number of the column to fetch |
variable |
Variable to hold the fetched value |
Example
SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Active' "
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
SQL_FETCH_NEXT_ROW
SQL_GET_NUM_COLS to iCols
For fieldIndex from 1 to iCols
SQL_FETCH_COLUMN fieldIndex into sValue
Showln sValue
Loop