SQL/MX Programming Manual for Java
SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java—523726-003
4-16
DECLARE and SET Statements for Object Name
Qualification
DECLARE and SET Statements for Object
Name Qualification
DECLARE and SET statements qualify the unqualified database object names in an
SQLJ program and include:
•
DECLARE CATALOG and SET CATALOG, which set the default catalog for
unqualified schema names in SQL statements
•
DECLARE MPLOC and SET MPLOC, which set the default volume and
subvolume for unqualified Guardian physical names in SQL statements
•
DECLARE NAMETYPE and SET NAMETYPE, which set the default NAMETYPE
attribute value to ANSI (logical names) or NSK (Guardian physical names) for SQL
statements
•
DECLARE SCHEMA and SET SCHEMA, which set the default schema (and
optionally, the catalog) for unqualified object names in SQL statements
The DECLARE statements affect the static and dynamic SQL statements in an SQLJ
program, while the SET statements affect the dynamic SQL statements in an SQLJ
program. For information about why dynamic execution occurs, see Static and
Dynamic SQL on page 4-1.
For the syntax of these statements, see the SQL/MX Reference Manual.
ANSI Compliance and Portability
If program portability is important, note that the DECLARE, SET MPLOC, and SET
NAMETYPE statements are SQL/MX extensions to the ANSI standard.
DECLARE Statements for Static SQL
The DECLARE statements are SQL/MX compiler directives that execute statically and
affect static SQL statements with the same connection context class in an SQLJ
program.
Placement of the DECLARE Statements
Place the DECLARE statements anywhere executable statements are 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
DECLARE statement, place the DECLARE statement after the instantiation of the
connection context object. You may specify an execution context for a DECLARE
statement, but SQLJ ignores it.