SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)

Name Resolution, Similarity Checks, and Automatic
Recompilation
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
8-2
Table and View Name References
ANSI Names for SQL/MX Objects
You can use only an ANSI logical name for SQL/MX tables or views in an SQL
statement:
EXEC SQL
SELECT jobcode, jobdesc
INTO :hv_jobcode, hv_jobdesc
FROM newyork.persnl.job
WHERE jobcode = :hv_this_jobcode;
When you hard code a table name in the ANSI logical format, the logical name is
tightly bound to a physical table when the SQL statement is compiled. To make the
statement refer to some other physical table, you need to edit the source code and
recompile the module.
For the syntax of this type of database object name, see the SQL/MX Reference
Manual.
Guardian Names for SQL/MP Objects
You can use the Guardian physical name for SQL/MP tables or views in an SQL
statement:
EXEC SQL
SELECT jobcode, jobdesc
INTO :hv_jobcode, hv_jobdesc
FROM \ny.$data01.persnl.job
WHERE jobcode = :hv_this_jobcode;
When you hard code a table name in the Guardian format, the physical name is tightly
bound to the SQL statement when the SQL statement is compiled. To make the
statement refer to some other physical table, you must edit the source code and
recompile the module.
For the syntax of this type of database object name, see the SQL/MX Reference
Manual.
SQL/MP Aliases for SQL/MP Objects
To use logical names for SQL/MP tables or views, create an SQL/MP alias that maps
to a Guardian physical name and refer to the SQL/MP alias in the SQL statement.
To create an SQL/MP alias, issue a CREATE SQLMP ALIAS statement in MXCI:
CREATE SQLMP ALIAS samdbcat.persnl.employee
$samdb.persnl.employee;
In the source file, refer to the SQL/MP alias as:
EXEC SQL DELETE FROM samdbcat.persnl.employee
If you embed a CREATE SQLMP ALIAS statement in your embedded SQL program,
subsequent references to the SQL/MP alias in the same program cause compilation