SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Embedded SQL Statements
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
2-12
Considerations for Embedding DDL and DML
Statements
Considerations for Embedding DDL and DML Statements
The most practical way to create your database objects is through OBEY command
files in MXCI. By using OBEY scripts, you avoid compilation. However, you might have
a reason for embedding DDL and DML statements within the same program. If you
should do this, understand that the DDL statements create the objects at run time, not
compile time. At compile time, subsequent DML statement on those objects are not
compiled statically because the objects do not exist in the database at compile time. At
run time, the DML statements execute dynamically.
For information on DDL and DML statements, see the SQL/MX Reference Manual.
Considerations for Embedding the UPDATE STATISTICS
Statement
It is not recommended that your application start a transaction prior to executing
UPDATE STATISTICS because UPDATE STATISTICS will execute under the user
transaction. However, you can embed UPDATE STATISTICS in C programs because
the C preprocessor does not start transactions automatically. Transactions are started
when you use the BEGIN WORK statement in the application.
Using CONTROL Statements
CONTROL statements are SQL/MX compiler directives that affect the execution of
SQL statements in a program and that enable you to override the system-level default
settings for the current process. CONTROL statements include:
•
CONTROL QUERY DEFAULT, which overrides system-level default settings
Utilities
UPDATE STATISTICS Updates information on the content of a table
and its indexes.
Stored Procedures (SPJ)
CALL Statement The CALL statement invokes a stored
procedure in Java (SPJ) and can be
embedded in a C, C++, or COBOL program.
Both static and dynamic CALL statements
are supported. See SQL/MX Guide to Stored
Procedures in Java or the SQL/MX
Reference Manual for examples and more
information.
Table 2-4. Executable SQL Statements (page5of5)
Statement Description
* Indicates the statement is an SQL/MX extension.