SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
G-3
Consideration—GET VERSION
For type CATALOG, name must be a catalog name or a DEFINE of class
CATALOG. For type SYSTEM, name is optional (the default is the local node) but
must be a node name with a leading “\” if specified. For all other types name must
be a Guardian name (or an equivalent DEFINE).
INTO :var
(static SQL programs only) specifies a host variable in which to return the version.
Consideration—GET VERSION
In host language programs, GET VERSION returns an integer value. The variable to
receive the value must be compatible with the SQL data type UNSIGNED SMALLINT.
For static SQL, specify the variable in the INTO clause of GET VERSION. For dynamic
SQL, specify the variable in the RETURNING clause of the EXECUTE or specify an
output SQLDA in the RETURNING USING DESCRIPTOR clause of the EXECUTE.
(You cannot use GET VERSION with EXECUTE IMMEDIATE.)
GET VERSION also sets SQLCODE to report status and fills in the SQLCA. GET
VERSION has no EXPLAIN output.
Examples—GET VERSION
This SQLCI example retrieves the version of table mytable:
GET VERSION OF TABLE mytable;
VERSION: 1
--- SQL operation complete.
This SQLCI example retrieves the version of catalog mycat:
GET VERSION OF CATALOG mycat;
VERSION: 300
--- SQL operation complete.
This SQLCI statement retrieves the version of index myindx:
GET VERSION OF INDEX myindx;
VERSION: 315
---SQL operation complete.
This static SQL statement from a C, Pascal, or TAL program retrieves the version
of table mytable and stores it in hostvar1:
EXEC SQL GET VERSION OF TABLE mytable INTO :hostvar1;
This static SQL statement from a COBOL program retrieves the version of index
IDX2 and stores it in hostvar2:
EXEC SQL GET VERSION OF INDEX idx2 INTO :hostvar2;