SQL/MP Programming Manual for C

SQL/MP Statements and Directives
HP NonStop SQL/MP Programming Manual for C429847-008
3-2
Placing Statements and Directives
FROM =customer
WHERE custnum = :find_this_customer
;
Placing Statements and Directives
Place SQL statements and directives and C compiler pragmas in a C source file.
SQL Pragma
To use embedded SQL statements and directives in a C program, you must specify the
SQL pragma before any SQL or C statements (except comment statements). You can
specify the SQL pragma either in your source file or as a compiler option in the implicit
TACL RUN command that starts the C compiler. This example uses the SQL pragma in
a source code file:
#pragma SQL
This example uses the SQL pragma as a compiler option:
C / IN csrc, OUT $s.#clst, NOWAIT / cobj; SQL
After the SQL pragma, place other SQL statements and directives in a C source file as
described in these paragraphs.
C Variable Declarations
You can use these statements and directives with C variable declarations:
BEGIN DECLARE SECTION and END DECLARE SECTION directives
DECLARE CURSOR statements for static SQL operations
INVOKE directive
INCLUDE STRUCTURES directive
INCLUDE SQLCA, INCLUDE SQLSA, and INCLUDE SQLDA directives
C Executable Statements
You can use these statements with C executable statements:
Data manipulation language (DML) statements
Data control language (DCL) statements
Data definition language (DDL) statements
Data status language (DSL) statements
Transaction control statements
Dynamic SQL statements (including DECLARE CURSOR)