SQL Programming Manual for TAL
NonStop SQL Version Issues
HP NonStop SQL Programming Manual for TAL—527887-001
D-12
Techniques for Mixed-Version Programming
(T9193C10^15MAR89, T9193AAF) component SOFTDOC for the C10 versioning 
PVUs. 
For C30 programs, external declarations for these procedures are included in the 
EXTDECS system file for TAL programs.
Techniques for Mixed-Version Programming
A generic release program can run on multiple release levels of NonStop SQL and 
handle Version 1 and Version 2 catalogs and objects. The techniques for developing a 
generic release program is:
•
Running on multiple NonStop SQL releases
•
Handling mixed-version objects
•
Using the single-code thread design
Handling Mixed-Version-Objects
Both generic release programs and programs that run only on NonStop SQL C30 
systems can use these techniques to handle objects of mixed versions:
•
Use the SQL system procedures to determine the NonStop SQL object version or 
catalog version. Then, execute code depending on information returned by each 
procedure.
•
Include two sets of catalog queries if the program queries the catalogs and is 
sensitive to the difference between Version 1 and Version 2 catalogs. Before 
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 an object before reading information from the catalog tables. 
If the version of the object is unknown, do not try to read the catalog information. 
Otherwise, you might encounter unknown column values.
•
Consider querying the VERSIONS catalog table as an alternative test to determine 
catalog version. The value of the VERSIONS column represents the catalog 
version as follows:
°
“A010” Version 1 catalog
°
“A011” Version 2 catalog
•
Check the catalog version before executing certain DDL statements. You must be 
sure to register objects in Version 2 catalogs for these operations:
°
Create Version 2 tables, views, indexes, or constraints










