5. Embedded SQL for Ada : 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 Ada 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 Ada constructs that do not allow empty statements. For example, coding a declare cursor statement as the only statement in an Ada if statement causes compiler errors:
if (using_database) then
        exec sql declare empcsr cursor for
                select ename from employee;
else
        put_line("You have not accessed the database.");
end if;
The preprocessor generates the code:
if (using_database) then
else
        put_line("You have not accessed the database.");
end if;
This is an illegal use of the Ada if-then-else statement.