SQL Programming Manual for TAL
HP NonStop SQL Programming Manual for TAL—527887-001
3-1
3
NonStop SQL Statements and
Directives
This section describes:
•
NonStop SQL statements and directives that you can embed in a TAL program
•
SQL, SQLMEM, and SYMBOLPAGES TAL compiler directives
The NonStop SQL statements and directives that are described in this section have
specific TAL data structures, considerations, and examples. For the complete
description and syntax of all NonStop SQL statements and directives, see the SQL/MP
Reference Manual.
For a description of all TAL compiler directives, see the TAL Reference Manual.
Embedding SQL Statements and Directives
An SQL statement or directive embedded in a TAL program must begin with the
keywords EXEC SQL and end with a semicolon (;) or an END, ELSE, or UNTIL
keyword according to TAL statement separator conventions. The syntax is:
sql-statement-or-directive
is an SQL statement or directive that is allowed in a TAL program as shown in
Table 3-1 on page 3-4.
You terminate an embedded SQL statement or directive as follows:
•
In the data declarations, terminate an SQL statement or directive with a semicolon:
EXEC SQL BEGIN DECLARE SECTION; ! SQL directive
INT .name ; ! Host variable
EXEC SQL END DECLARE SECTION; ! SQL directive
•
In the executable statements, terminate an SQL statement with a semicolon except
before an END, ELSE, or UNTIL keyword as appropriate for the TAL statement:
IF in^numvars > 0 THEN
EXEC SQL EXECUTE state^ment^1 USING DESCRIPTOR :sdao
ELSE
EXEC SQL EXECUTE state^ment^2;
EXEC SQL sql-statement-or-directive [;]