You can include Embedded SQL statements in the portions of your C code where C functions or routines can be placed. To distinguish Embedded SQL statements from C source code, each Embedded SQL statement must begin with the introductory keyword EXEC SQL and end with a semicolon (;). An Embedded SQL statement that does not end with a semicolon (;) usually results in nsqlprep compiler error -19104 “Incorrect SQL statement syntax.”
You can use a backslash (\) to continue Embedded SQL strings across more than one line of source code. A single quotation mark must precede the first character of the Embedded SQL string on the first line of source code, and a single quotation mark must appear after the last character of the string on the last line of source code. For example:
EXEC SQL INSERT INTO TEXT132 VALUES (‘TEST 192 IS THE TEST FOR THE R\
ULE OF THE CONTINUATION OF LINES FROM ONE LINE TO THE NEXT LINE.’);
You can also insert C language code after the EXEC SQL keyword on the same line. For example:
EXEC SQL COMMIT TRAN; printf("\n");
Note When you include C language code after an EXEC SQL keyword on the same line, you must use the /NOLINES precompiler option.
You can also include Embedded SQL variable declaration sections in C language code where it is valid to declare variables. Use the BEGIN DECLARE SECTION and END DECLARE SECTION statements.
The scope of Embedded SQL variable names (statements, cursors, and connections) follow the rules that apply to C variables.