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

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
3-31
DECLARE NAMETYPE Declaration
DECLARE NAMETYPE Declaration
The DECLARE NAMETYPE declaration is a compiler directive that sets the default
NAMETYPE attribute value to ANSI or NSK for static SQL statements that follow the
declaration within a compilation unit.
DECLARE NAMETYPE is used by the preprocessor when the INVOKE directive is not
fully qualified.
DECLARE NAMETYPE is an SQL/MX extension that you use only in embedded SQL
programs.
default-nametype
is a character string literal that specifies the NAMETYPE attribute value used to
refer to SQL/MP database objects. 'ANSI' indicates logical names (ANSI), and
'NSK' indicates physical Guardian names.
If you do not specify DECLARE NAMETYPE, the default NAMETYPE is ANSI.
Considerations for DECLARE NAMETYPE
Scope of DECLARE NAMETYPE
You can specify more than one DECLARE NAMETYPE 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 NAMETYPE directive is in effect when the SQL/MX compiler
encounters an unqualified object name, the compiler uses the value of the NAMETYPE
attribute 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 NAMETYPE
Set the default NAMETYPE attribute value to use Guardian physical names:
EXEC SQL DECLARE NAMETYPE 'NSK';
COBOL Examples of DECLARE NAMETYPE
Set the default NAMETYPE attribute value to use Guardian physical names:
EXEC SQL DECLARE NAMETYPE 'NSK' END-EXEC.
DECLARE NAMETYPE default-nametype
C/COBOL