Considerations For Transpose; Multiple Transpose Clauses And Sets; Degree And Column Order Of The Transpose Result; Data Type Of The Transpose Result - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

transpose-col-list
specifies the columns that consist of the evaluation of expressions in the item list as the
expressions are applied to rows of the source table.
colname
is an SQL identifier that specifies a column name. It identifies the column consisting
of the values in expression-list.
For example, in the transpose set TRANSPOSE A,B,C AS V, the column V corresponds
to the values of the expressions A,B, and C.
(colname-list)
specifies a list of column names enclosed in parentheses. Each column consists of the
values of the expressions in the same ordinal position within the parentheses in the
transpose item list.
For example, in the transpose set TRANSPOSE (A,X),(B,Y),(C,Z) AS (V1,V2), the
column V1 corresponds to the expressions A,B, and C, and the column V2 corresponds
to the expressions X,Y, and Z.
KEY BY key-colname
optionally specifies which expression (the value in the transpose column list corresponds to)
by its position in the item list. key-colname is an SQL identifier. The data type of the key
column is exact numeric, and the value is NOT NULL.

Considerations for TRANSPOSE

Multiple TRANSPOSE Clauses and Sets

Multiple TRANSPOSE clauses can be used in the same query. For example:
SELECT KEYCOL1, VALCOL1, KEYCOL2, VALCOL2 FROM MYTABLE
TRANSPOSE A, B, C AS VALCOL1
KEY BY KEYCOL1
TRANSPOSE D, E, F AS VALCOL2
KEY BY KEYCOL2
A TRANSPOSE clause can contain multiple transpose sets. For example:
SELECT KEYCOL, VALCOL1, VALCOL2 FROM MYTABLE
TRANSPOSE A, B, C AS VALCOL1
KEY BY KEYCOL

Degree and Column Order of the TRANSPOSE Result

The degree of the TRANSPOSE result is the degree of the source table (the result table derived
from the table reference or references in the FROM clause and a WHERE clause if specified),
plus one if the key column is specified, plus the cardinalities of all the transpose column lists.
The columns of the TRANSPOSE result are ordered beginning with the columns of the source
table, followed by the key column if specified, and then followed by the list of column names in
the order in which they are specified.

Data Type of the TRANSPOSE Result

The data type of each of the value columns is the union compatible data type of the corresponding
expressions in the transpose-item-list. You cannot have expressions with data types that
are not compatible in a transpose-item-list.
For example, in TRANSPOSE (A,X),(B,Y),(C,Z) AS (V1,V2), the data type of V1 is the union
compatible type for A, B, and C, and the data type of V2 is the union compatible type for X, Y,
and Z.
See
"Comparable and Compatible Data Types" (page
272
SQL Clauses
D, E, F AS VALCOL2
199).

Advertisement

Table of Contents
loading

Table of Contents