In a QUERY expression with at least a UNION, INTERSECT or EXCEPT specification, all sequences of selected columns must designate the same number of columns. The data types of the corresponding columns must thereby comply with the conditions valid for comparability.
Each data type can be compared to itself. Columns of data type CHAR with the different code attributes ASCII and UNICODE can be compared to each other; they are implicitly adapted. The columns of code attribute ASCII can be compared to date, time, and timestamp specifications.
All numbers can be compared to each other.
In SQL mode ANSI, it is not sufficient that the data types and lengths of the specified columns are compatible; they must be equal. Moreover, only column specifications or * may be specified in the SELECT COLUMNs of the QUERY specifications connected by UNION. The specification of literals is not allowed.
Use a QUERY statement issued on the system table DOMAIN.COLUMNS to find out the definition of the specified columns. It may be attempted to achieve comparability by applying a conversion function.
This request cannot be made in SQL mode ANSI.