SQL Programming Manual for Pascal
NonStop SQL Version Issues
HP NonStop SQL Programming Manual for Pascal—528614-001
D-13
Generic Release Programs
executing a catalog query, the program can use the SQLGETCATALOGVERSION 
procedure to check the SQL catalog version. The program executes the 
appropriate query depending on the catalog version. For example, if a program 
wants to determine whether a user table contains date-time columns and the 
attributes of those columns, the program must first determine whether the catalog 
in which the table is registered is a Version 2 catalog.
•
Check the version of the object being processed before reading information from 
the catalog tables. If the version of the object is unknown to the program, do not 
attempt to read the catalog information; otherwise, the program might encounter 
column values that are unknown to the program.
•
Consider querying the VERSIONS catalog table as an alternative test to determine 
catalog version. The value of the VERSIONS column represents catalog version as 
follows:
A010 Version 1 catalog
A011 Version 2 catalog
•
Have the program check the catalog version before executing certain DDL 
statements. The program must be sure to register objects in Version 2 catalogs for 
the following operations:
°
Create Version 2 tables, views, indexes, or constraints
°
Create partitions for Version 2 tables or indexes
°
Add a column that has a Version 2 data type
For the last operation listed, the program would issue an error if the table intended 
to get the new column were registered in a Version 1 catalog. Alternatively, the 
program can perform the operation, let NonStop SQL check the Version 1 catalog, 
and return the SQL error to the program.
For all the preceding operations, the system will return an error if an attempt is made to 
register a Version 2 object in a Version 1 catalog.
Running on Multiple NonStop SQL Releases
Programs that run on multiple NonStop SQL releases and use Version 2 features 
whenever possible must determine the SQL release level. Typically, these programs 
handle objects of multiple versions by using dynamic SQL. Some coding techniques, 
however, enable static SQL statements to handle multiple versions.
When developing generic release programs, you should consider the following 
techniques:
•
Maintain two code threads in a single set of source programs and use conditional 
compilation to build two different object files depending on the version of the 
NonStop SQL software release. This technique requires parallel build and release 
cycles to install the program on nodes of different versions.










