2. Embedded SQL for C : Embedded SQL Statement Syntax for C : Comments
 
Share this page                  
Comments
You can include C comments, delimited by /* and */ anywhere in an embedded SQL statement that a blank is allowed, with the following exceptions:
Between the margin and the word exec (whether or not you have a C label prefix).
Between the word exec and the word sql or frs. In the following example, comments cause both statements to be interpreted as C host code:
/* Initial comment */ exec sql include sqlca;
exec /* Between */ sql commit;
Between words that are reserved when they appear together. For the list of double reserved words contained in the list of keywords, see the SQL Reference Guide.
In string constants.
In parts of statements that are dynamically defined. For example, a comment in a string variable specifying a form name is interpreted as part of the form name.
Between component lines of embedded SQL/FORMS block‑type statements. All blocktype statements (such as activate and unloadtable) are compound statements that include a statement section delimited by begin and end. Comment lines must not appear between the statement and its section. The preprocessor interprets such comments as C host code, which causes preprocessor syntax errors. (However, comments can appear on the same line as the statement.)
For example, the following statement causes a syntax error on the C comment:
exec frs unloadtable empform
         employee (:namevar = ename);
    /* Illegal comment before statement body */
    exec frs begin; /* Comment legal here */
         strcat(msgbuf, namevar);
    exec frs end;
Between any components in a statement composed of more than one compound statement. An example of such a statement is the display statement, which typically consists of the display clause, an initialize section, activate sections, and a finalize section. C comments are translated as host code and cause syntax errors on subsequent statement components.
You can also use the SQL comment delimiter (-) to indicate that the rest of the line is a comment.
Example: Comment delimiter usage
exec sql delete            --Delete all employees
    from employee;