Representing a SQL Statement as a Character String
Go Up to Writing an API Application to Process SQL Statements
Within a DSQL application, a SQL statement can come from different sources. It might come directly from a user who enters a statement at a prompt, as does isql
. Or it might be generated by the application in response to user interaction. Whatever the source of the SQL statement, it must be represented as a SQL statement string, a character string that is passed to DSQL for processing.
SQL statement strings do not begin with the EXEC SQL
prefix or end with a semicolon (;) as they do in typical embedded applications. For example, the following host-language variable declaration is a valid SQL statement string:
char *str = "DELETE FROM CUSTOMER WHERE CUST_NO = 256";
- Note: The semicolon that appears at the end of this char declaration is a C terminator, and not part of the SQL statement string.