Embed SQL statements
The program can use SQL statements to communicate with the database server. The program can use both static and dynamic SQL statements.
A static SQL statement is one in which all the components are known when you compile the program. A dynamic SQL statement is one in which you do not know all the components at compile time; the program receives all or part of the statement at run time. For a description of dynamic SQL, see Using dynamic SQL.
- The EXEC SQL keywords:
EXEC SQL SQL_statement;
Using EXEC SQL keywords is the ANSI-compliant method to embed an SQL statement.
- The dollar sign ($) notation:
$SQL_statement;
In either of these formats, replace SQL_statement with the complete text of a valid statement. statements can include host variables in most places where you can use a constant. For any exceptions, see the syntax of individual statements in the HCL OneDB™ Guide to SQL: Syntax.