SQL/MP Programming Manual for C
HP NonStop SQL/MP Programming Manual for C—429847-008
3-1
3
SQL/MP Statements and Directives
For a detailed description, including the syntax, of all SQL/MP statements and 
directives, see the SQL/MP Reference Manual.
This section includes:
Embedding SQL Statements
Finding Information on page 3-3
Embedding SQL Statements 
Use this syntax to embed a NonStop SQL/MP statement or directive in a C source file. 
sql-statement-or-directive 
is any SQL statement or directive shown in Table 3-1 on page 3-3. The statement 
or directive must begin with the keywords EXEC SQL and end with a semicolon (;).
Coding Statements and Directives
In general, handle embedded SQL statements and directives as if they were 
C statements. Follow the same formatting and line continuation conventions that you 
use for C statements. Here are a few specific guidelines to follow when you code 
embedded SQL statements and directives in a C program:
Do not nest SQL statements or directives.
Use only SQL comments in SQL statements and directives. SQL comments begin 
with a double hyphen (--) and end with the end of the line. You cannot use 
C comments in SQL statements or directives.
Use only the C string delimiter, a double quote ("), for quoted strings.
Code an SQL statement or directive on a single source code line or over several 
lines:
EXEC SQL WHENEVER SQLERROR :handle_error; 
EXEC SQL DROP TABLE \ny.$disk1.invent.supplier; 
EXEC SQL 
 SELECT customer.custname 
 INTO :customer.custname 
EXEC SQL sql-statement-or-directive ; 










