SQL/MP Version Management Guide
Database Versions
Compaq NonStop™ SQL/MP Version Management Guide—429833-001
3-8
Retrieving Catalog Versions
For the syntax of the GET VERSION OF CATALOG statement and for examples of
using this statement in a static or dynamic SQL program, see the NonStop SQL/MP
Reference Manual and the NonStop SQL/MP Programming Manual for the language
you are using.
Using Catalog Queries
You can retrieve the catalog version from either the VERSION or CATALOGVERSION
column of a system or user catalog. (For catalogs with versions older than 300, only the
VERSION column is available.) You can also retrieve the catalog format version from a
user catalog. (See Tables 3-1 and 3-2 for the tables and columns that contain catalog
version and catalog format version information.)
As a general rule, you should avoid querying either the user catalog or system catalog
tables to retrieve the version of a catalog while there are active DDL (Data Definition
Language) operations. Your query might result in contention for the affected tables,
possibly degrading performance. If you do need to obtain the version of a catalog by
querying the user catalog or system catalog table, use these guidelines to ensure that
your queries work on all catalog versions:
•
Specify column names explicitly. Do not use an asterisk (*) to select all columns in
a query statement (as in SELECT *). This syntax might return columns that older-
version programs might not be able to interpret.
•
Query the CATALOGFORMAT column and the CATALOGVERSION column to
determine whether the structure of your catalog has changed.
For example, to determine the format and version of the catalog on a subvolume named
\SYS2.$VOL1.SALES, enter this query to retrieve information from the VERSIONS
table on that subvolume:
>> VOLUME \SYS2.$VOL1.SALES;
>> SELECT CATALOGFORMAT, CATALOGVERSION
+> FROM VERSIONS;
The response to this query is:
CATALOGFORMAT CATALOGVERSION
------------- --------------
315 315
--- 1 row(s) selected.
Using the SQLGETCATALOGVERSION Procedure
SQLGETCATALOGVERSION is a TAL procedure you can call from a program to
retrieve the catalog version, but not the catalog format version. You can call the
SQLGETCATALOGVERSION procedure from version 2 SQL programs and version
300 and newer programs. The procedure is not available to version 1 programs and will
be phased out in a future release of SQL/MP. Therefore, use the GET VERSION OF
CATALOG statement in any version 300 or newer programs.
For information on developing programs that are version independent, see Section 7,
Version Compatibility for SQL Programs.