SQL/MX 2.x Reference Manual (H06.04+)

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
3-21
DECLARE CATALOG Declaration
DECLARE CATALOG Declaration
The DECLARE CATALOG declaration is a compiler directive that sets the default
catalog for unqualified schema names in static SQL statements that follow the
declaration within a compilation unit. The DECLARE SCHEMA declaration sets the
default schema name. See DECLARE SCHEMA Declaration on page 3-32.
DECLARE CATALOG is an SQL/MX extension that you use only in embedded SQL
programs.
default-catalog
is a character string literal that specifies a catalog name. A string literal is enclosed
in single quotation marks. 'mycatalog' is the form, where mycatalog is the
name you choose.
Considerations for DECLARE CATALOG
Scope of DECLARE CATALOG
You can specify more than one DECLARE CATALOG directive in an embedded SQL
program. Each directive replaces the preceding directive and stays in effect until it is
replaced by another directive or until the end of the program’s compilation unit is
reached.
If no DECLARE CATALOG directive is in effect when the SQL/MX compiler encounters
an unqualified schema name, the compiler uses the catalog as determined by
NonStop SQL/MX. For more information, see Object Naming on page 10-48 and the
SQL/MX Programming Manual for C and COBOL.
C Examples of DECLARE CATALOG
Set the default catalog:
EXEC SQL DECLARE CATALOG 'SAMDBCAT';
COBOL Examples of DECLARE CATALOG
Set the default catalog:
EXEC SQL DECLARE CATALOG 'SAMDBCAT' END-EXEC.
DECLARE CATALOG default-catalog