Was this helpful?
Coding Requirements for Embedded SQL Programs
The following sections describe coding requirements for writing Embedded SQL programs.
Comments Embedded in BASIC Output
Each Embedded SQL statement generates one comment and a few lines of BASIC code. You may find that the preprocessor translates 50 lines of Embedded SQL into 200 lines of BASIC. This can confuse the program developer who is trying to debug the original source code. To facilitate debugging, each group of BASIC statements associated with a particular statement is delimited by a comment corresponding to the original Embedded SQL source. Each comment is one line long and informs the reader of the file name, line number, and type of statement in the original source file.
Embedded Statements Inside BASIC If Blocks
As mentioned above, the preprocessor never generates line numbers on its own. Therefore, you can enclose Embedded SQL statements in the then or else clause of a BASIC if statement without changing program control. For example:
if (error = 1) then
        exec sql message 'Error on update'
        exec sql sleep 2
end if
Embedded SQL Statements that Do Not Generate Code
The following Embedded SQL declarative statements do not generate any BASIC code:
declare cursor
declare statement
declare table
These statements must not contain labels. Also, they must not be coded as the only statements in BASIC constructs that do not allow empty statements.
Last modified date: 06/10/2024