2. Embedded SQL for C : Preprocessor Operation : Coding Requirements for Embedded SQL Programs : Embedded SQL Statements that Do Not Generate Code
 
Share this page                  
Embedded SQL Statements that Do Not Generate Code
The following embedded SQL declarative statements do not generate any C code:
declare cursor
declare table
declare statement
whenever
These statements must not contain labels and must not be coded as the only statements in C constructs that do not allow null statements. For example, coding a declare cursor statement as the only statement in a C if statement not bounded by left and right braces causes compiler errors:
if (using_database)
      exec sql declare empcsr cursor for
                   select ename from employee;
 else
        printf("You have not accessed the database.\n");
The preprocessor generates the code:
if (using_database)
 else
      printf("You have not accessed the database.\n");
This is an illegal use of the C else clause.