Map column names into Panther variables using a
DBMS [ WITH CURSOR
cursor] COLUMN_NAMES [
pantherVar... ] ]
- Name of Panther variable to contain the column name.
- Name of declared
SELECTcursor. If the clause is not used, Panther uses the default
COLUMN_NAMESfetches the column names, not the column data, into Panther variables when a
SELECTstatement is executed.
The correspondence between the Panther variable and the column is positional. The first Panther variable named in the
COLUMN_NAMEScommand will contain the name of the first column listed in the
SELECTstatement. If the number of Panther variables is greater than the number of columns, the remaining Panther variables are ignored. If the number of columns is greater than the number of Panther variables, the remaining columns are ignored.
SELECTstatement includes data which is not a column, like an aggregate function, then the value written to the Panther variable is whatever is returned from the database engine.
A Panther variable can be a widget or JPL variable. If the variable is an array or multi-occurrence widget, the column name appears in the first occurrence unless a particular occurrence is specified.
COLUMN_NAMESstatement is allowed for each cursor. The last
COLUMN_NAMESstatement called is the one currently in effect.
Column name aliasing for a cursor is turned off by executing the
COLUMN_NAMEScommand with no arguments. Closing a cursor also turns it off. If a cursor is redeclared without being closed, the cursor keeps the aliases.
// Assign column name aliases for a declared cursor.
// The column names are written to id_title, copy_title
// and status_title.
// The data is written is title_id, copy_num and status.DBMS DECLARE x CURSOR FOR \
SELECT title_id, copy_num, status FROM tapes
DBMS WITH CURSOR x COLUMN_NAMES \
id_title, copy_title, status_title
DBMS WITH CURSOR x EXECUTE
DBMS WITH CURSOR x COLUMN_NAMES// Assign column name aliases for the default cursorDBMS COLUMN_NAMES id_title, copy_title, status_title
DBMS QUERY SELECT title_id, copy_num, status \