SQL Programming Manual for TAL
NonStop SQL Version Issues
HP NonStop SQL Programming Manual for TAL—527887-001
D-13
Running on Multiple NonStop SQL Releases
°
Create partitions for Version 2 tables or indexes
°
Add a column that has a Version 2 data type
For the last operation, you would have to issue an error if the table intended to get the
new column was registered in a Version 1 catalog. For all of the above operations, the
system returns an error if a program attempts 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 these 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.
Advantages of this technique are:
°
Dynamic SQL is not necessary.
°
Program logic is simpler than in the single-code thread design.
•
Maintain a single-code thread by using IF/THEN/ELSE statements in the source
program; the statements test for the appropriate SQL version and choose between
two code branches at run time. This technique contrasts with the two-code thread
technique by performing version checking at run time instead of at compile time;
the use of the single-code thread technique precludes the use of the two-code
thread technique.
Typically, the single-code thread technique uses dynamic SQL and can require
extensive mixed-version code. The resulting single object file, however, needs only
a single build and release cycle to install the program on nodes of different
versions.
•
If you have a choice, use static SQL rather than dynamic SQL. Static SQL has
better performance than dynamic SQL because the SQL statements do not require
compilation at run time. Many generic release programs, however, require dynamic
SQL for other reasons.
•
Include the SQLGETSYSTEMVERSION procedure in program code to test for
system version. Then determine which code to execute depending on the version.










