7. Embedded SQL for Pascal : Embedded SQL Statement Syntax for Pascal : Labels
 
Share this page                  
Labels
Like Pascal statements, Embedded SQL statements can have a label prefix. The label must begin with a digit, an alphabetic character, or an underscore, must be the first word on the line (optionally preceded by white space), and must be terminated with a colon. For example:
close_cursor: exec sql close cursor1;
The label can appear anywhere a Pascal label can appear. As in standard Pascal, the label must be declared before it is used. This declaration must occur outside any Embedded SQL declaration section. Even though the preprocessor will accept a label in front of any exec sql or exec frs prefix, it may not be appropriate to code a label on some lines. For example, the following, although acceptable to the preprocessor, causes a compiler error because labels are not allowed before declarations:
include_sqlca: exec sql include sqlca;
As a general rule, use labels only with executable statements.