SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-21
Table and View Name References
Guardian Names for SQL/MP Objects
You can use the Guardian physical name for SQL/MP tables or views in an SQL
statement:
#sql {DELETE FROM $samdb.persnl.employee};
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 customized. To make the
statement refer to some other physical table, you must edit the source code,
recustomize the profile, 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 SQLJ source file, refer to the SQL/MP alias as:
#sql {DELETE FROM samdbcat.persnl.employee};
When you code a table name by using an SQL/MP alias, the logical name of the
SQL/MP alias is tightly bound to a physical table when the SQL statement is
customized. To make the statement refer to some other physical table, you must alter
the SQL/MP alias and then recustomize the profile and recompile the module. For
example, issue this ALTER SQLMP ALIAS statement before recustomizing:
ALTER SQLMP ALIAS samdbcat.persnl.employee
$samdb.persnl.employees_region2;
For information about embedding a CREATE SQLMP ALIAS statement in an SQLJ
program, see Using SQL/MP Alias Statements in an SQLJ Program on page 4-38. For
the syntax of the CREATE SQLMP ALIAS and ALTER SQLMP ALIAS statements, see
the SQL/MX Reference Manual.
DEFINE Names for SQL/MP Objects
You can refer to an SQL/MP table or view with a class MAP DEFINE that resolves to a
Guardian physical name:
#sql {DELETE FROM =emp};
When you use a DEFINE to refer to a table or view, you can customize the profile with
the DEFINE mapped to one table or view name, and then assign the DEFINE a
different name and recustomize the profile. The recustomized statement then refers to
the second table or view name for the DEFINE. This practice is called compile-time