SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Statements
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
2-94
Examples of CREATE SQLMP ALIAS
Late Bind
If you compile an application that uses an SQL/MP alias and later you change the
SQL/MP alias to map to a different SQL/MP table, the SQL/MP table definition is no
longer compatible with the definition used at compile time. As a result, you must
manually recompile applications that use the alias. If the late bind does not find the
SQL/MP table underlying the SQL/MP alias or if the SQL/MP table was moved,
NonStop SQL/MX returns an error.
For more information, see the SQL/MX Programming Manual for C and COBOL.
Embedding the Statement in an SQL Program
If you embed a CREATE SQLMP ALIAS statement in a static SQL program,
subsequent references in the same program to the SQL/MP alias cause compilation
errors because the alias does not reside in the OBJECTS table. To avoid these errors,
create logical name mappings separately before compiling static SQL programs that
refer to the SQL/MP alias. Compilation errors do not occur when you create and refer
to SQL/MP aliases in a dynamic SQL program. For more information on embedding
SQL in programs, see the SQL/MX Programming Manual for C and COBOL.
Partitioned Tables
Use the CREATE SQLMP ALIAS statement to create logical mappings for different
partitions of a table. That is, two partitions of the same table can be referenced with
different ANSI names. However, HP recommends that you map an alias to the primary
partition for accessing the entire partitioned table.
Aliases can be visible to a remote node through a REGISTER CATALOG statement
Authorization and Availability Requirements
To create, alter, or drop aliases, you must be the owner of the schema or be the super
ID.
Examples of CREATE SQLMP ALIAS
Suppose that you have created an SQL/MP table by using this SQL/MP CREATE
TABLE statement:
CREATE TABLE $myvol.mysubvol.mytable
( num NUMERIC (4) UNSIGNED NOT NULL
,name VARCHAR (20)
,PRIMARY KEY (num) );
This statement creates a mapping in the metadata table:
CREATE SQLMP ALIAS mycatalog.myschema.mytable
$myvol.mysubvol.mytable;
Embed