SQL_APPEND_STMT¶

Applies to: ORAFlex SQLFlex MYSQLFlex PGFlex DB2Flex

This command is used to append a command string to the command buffer initialized by SQL_SET_STMT. SQL_APPEND_STMT was added so that long SQL expressions could be broken into smaller strings and appended to a dynamic command buffer, which is then passed to the server. The SQL_APPEND_STMT will concatenate a string to the command buffer initialized by the SQL_SET_STMT command. SQL_APPEND_STMT can be called as many times as necessary to complete the SQL expression. Subsequently, the SQL_EXECUTE_STMT command executes the completed command. The option to pass the file name as an extra parameter is used in cases where the data needs to be fetched directly into the record buffer of the specified file.

Syntax

SQL_APPEND_STMT [of {file}] to {variable}

Parameter

Description

file

The name or number of the file (optional)

variable

The string to be appended to the current SQL expression

Usage

SQL_APPEND_STMT to " CUSTOMER.PHONE_NUMBER, CUSTOMER.FAX_NUMBER"
SQL_APPEND_STMT of Customer to " CUSTOMER.PHONE_NUMBER, CUSTOMER.FAX_NUMBER"

Example

Open Customer

String sID sFirstName sLastName sDOB

SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Active'"
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
While (Found)
    SQL_FETCH_NEXT_ROW into sID sFirstName sLastName sDOB
    Showln sID
    Showln sFirstName
    Showln sLastName
    Showln sDOB
Loop
SQL_CANCEL_QUERY_STMT