SQL Programming Manual for TAL
NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for TAL—527887-001
3-2
Coding Statements and Directives
Coding Statements and Directives
In general, consider embedded SQL statements and directives as if they are TAL
statements. Follow the same formatting and line continuation conventions for SQL
statements as you use for TAL statements. Here are a few specific guidelines to follow
when you embed SQL statements and directives in a TAL program:
•
You can code longer statements or directives on more than one line. For example:
EXEC SQL
SELECT customer.custname
INTO :customer.custname
FROM sales.customer
WHERE custnum = :find^this^customer;
•
Use either SQL or TAL comments in statements and directives.
An SQL comment statement begins with a double hyphen (--) and ends with the
end of the line.
A TAL comment statement can also begin with a double hyphen (--) and end with
the end of the line, or it can begin with an exclamation point (!) and end with
another exclamation point or the end of the line.
•
Use either a single quotation mark (') or double quotation marks (") to delimit string
literal statements; however, you must use the same character at both ends of the
string.
•
Do not use an SQL statement as part of a compound TAL statement.
•
Do not use a TAL DEFINE declaration in an SQL statement.
Placing Statements and Directives in a Program
Place SQL statements and directives in a TAL source file as described next:
SQL Directive
To embed SQL statements and directives in a TAL program, specify the SQL directive
before any SQL or TAL declarations and source code statements (including comment
statements). The SQL directive enables the TAL compiler to process subsequent SQL
statements and directives.
Specify the SQL directive either in your source code file or as a compiler option in the
implicit TACL RUN command for the TAL compiler. An example of the SQL directive in
a source code file is:
?SQL
An example of the SQL directive as a compiler option is:
TAL /IN tsrc, OUT $s.#tlst, NOWAIT/ tobj; SQL