![]() | ![]() | Programming Guide |
Map column names into Prolifics variables using a
SQLSELECTstatement
DBMS [ WITH CURSOR cursor ] COLUMN_NAMES [ prolVar [, prolVar ... ] ]
prolVar- Name of Prolifics variable to contain the column name.
WITH CURSOR cursor- Name of declared
SELECTcursor. If the clause is not used, Prolifics uses the defaultSELECTcursor.
DBMSCOLUMN_NAMESfetches the column names, not the column data, into Prolifics variables when a SQLSELECTstatement is executed.The correspondence between the Prolifics variable and the column is positional. The first Prolifics variable named in the
DBMSCOLUMN_NAMEScommand will contain the name of the first column listed in theSQLSELECTstatement. If the number of Prolifics variables is greater than the number of columns, the remaining Prolifics variables are ignored. If the number of columns is greater than the number of Prolifics variables, the remaining columns are ignored.If the
SQLSELECTstatement includes data which is not a column, like an aggregate function, then the value written to the Prolifics variable is whatever is returned from the database engine.A Prolifics 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.
Only one
DBMSCOLUMN_NAMESstatement is allowed for each cursor. The lastDBMSCOLUMN_NAMESstatement called is the one currently in effect.Column name aliasing for a cursor is turned off by executing the
DBMSCOLUMN_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 SQL SELECT title_id, copy_num, status \
FROM tapes
DBMS COLUMN_NAMES
![]()
![]()
![]()
![]()