ALLBASE/SQL Reference Manual (36216-90216)

504 Chapter12
SQL Statements S - Z
SELECT
The union is derived by first inserting each row of T1 and each row of T2 into a result
table and then eliminating any redundant rows unless ALL is specified.
The result of the union inherits the column names specified for T1.
The maximum number of query blocks within a query expression is 16.
Data types of corresponding columns in T1 and T2 must be comparable. When
columns are of the same type but of different sizes, the result has the length of the
longer of the source columns.
The ORDER BY clause can specify the ordinal number or the column name of a column
in the
leftmost
query expression in a UNION.
You cannot use LONG columns in a UNION statement except in long string functions.
Table 12-1. shows the conversion rules for comparable data types:
Table 12-1. Conversion Rules for Data in Query Expressions
Data Type Source Columns Result Column Comment
Character One CHAR, one
VARCHAR
VARCHAR Result has the length of the
longer of the two source
columns.
One NATIVE CHAR,
one NATIVE
VARCHAR
NATIVE
VARCHAR
Result has the length of the
longer of the two source
columns.
One NATIVE CHAR,
one CHAR
NATIVE CHAR Result has the length of the
longer of the two source
columns.
One NATIVE
VARCHAR, one
CHAR or VARCHAR
NATIVE
VARCHAR
Result has the length of the
longer of the two source
columns.
One NATIVE CHAR,
one VARCHAR
NATIVE
VARCHAR
Result has the length of the
longer of the two source
columns.
One NATIVE
VARCHAR, one
VARCHAR
NATIVE
VARCHAR
Result has the length of the
longer of the two source
columns.