7. Embedded SQL for Pascal : 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 Pascal code:
declare cursor
declare statement
declare table
whenever
These statements must not contain labels. Also, they must not be coded as the only statements in Pascal constructs that do not allow null statements. For example, coding a declare cursor statement as the only statement in a Pascal if statement not bounded by begin and end would cause compiler errors:
if (using_database) then
    exec sql declare empcsr cursor for
         select ename from employee;
else
    writeln('You have not accessed the database');
The code generated by the preprocessor would be:
if (using_database) then
else
    writeln('You have not accessed the database');
This is an illegal use of the Pascal else clause.