SQL Statements
SQL statements are not part of the host language. They embedded in an application that is written in the host language. The compilation of such a program consists of two phases; the precompilation of the SQL statements contained in the application program followed by the compilation of the actual program itself.
The SQL statements must be invisible to the host language compiler during the compilation phase. In fact, the embedded SQL statements are commented out by the precompiler and are replaced by statements generated into the application program in a form that corresponds to the requirements of the host language.
The precompiler must be able to identify all embedded SQL statements. Therefore, all SQL statements are delimited by special SQL delimiters. It is not possible to have more than one SQL statement between one set of delimiters.
The SQL Starting Delimiter
The starting delimiter consists of a sequence of two words:
EXEC SQL
These words must be separated by one or more whitespace characters. They can be separated by one or more lines or blanks, and can be in upper or lower case, depending on what the host language permits.
In ANSI mode, the two keywords must be in upper case and must be separated by blanks (not lines).
The SQL Statement Body
Once the starting delimiter has been specified, the statement itself must be provided. The statement must be separated from the starting delimiter by at least one whitespace character and may be specified on the same line, or on a following line to the starting delimiter. The statement can be specified in either upper case or lower case and can be split over several lines. Each keyword or token must be separated by at least one whitespace character and must not be split over two or more lines. Keywords can be written in upper or lower case depending on the host language. In ANSI mode, keywords must be written in upper case only.