SQL/MX Programming Manual for Java
SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java—523726-003
4-32
Data Definition Language (DDL) Statements
Data Definition Language (DDL) Statements
Data definition language (DDL) statements define, delete, or modify the definition of a
catalog, schema, or database object, or the authorization to use a database object.
You can embed some of the SQL/MX DDL statements in an SQLJ program. For a list
of these statements, see Supported SQL Statements on page A-8.
For the best results, create database objects in a separate, earlier session (for
example, in MXCI) before translating and customizing a program that refers to them.
If you decide to embed SQL/MX DDL statements in an SQLJ program, follow these
guidelines:
•
Placement of DDL Statements on page 4-32
•
Scope of DDL Statements on page 4-32
•
Using Distributed Database Statements in an SQLJ Program on page 4-33
•
Distributing SQL/MX Objects From an SQLJ Program on page 4-35
•
Automatic Hash Partitioning From an SQLJ Program on page 4-37
•
Using SQL/MP Alias Statements in an SQLJ Program on page 4-38
Placement of DDL Statements
Place DDL statements anywhere an executable statement is allowed in an SQLJ
program. You cannot place these statements at the top-level scope of a program where
you code class declarations. If you associate a connection context with a DDL
statement, place the DDL statement after the instantiation of the connection context
object.
Scope of DDL Statements
At run time, all DDL operations start an MXCMP process regardless of whether they
were statically compiled during customization. DDL statements in an SQLJ program
always take effect at run time, not compile time. This behavior of DDL statements
affects DML statements that refer to the SQL/MX objects that are created, altered,
dropped, or granted or revoked permissions by the DDL statements.
If DML statements refer to SQL/MX database objects created by DDL statements in the
same SQLJ program, these DML statements are not customized and thus run
dynamically at run time. For more information, see Missing or Unavailable Database
Objects on page 4-2.
Note. To create SQL/MX database objects, you must have a license to use SQL/MX DDL
statements. To acquire this license, purchase product T0394. If you do not purchase this
product and you try to use SQL/MX DDL statements, an error message informs you that the
system is not licensed.