Background documentation-8028: UNION columns must be compatible Locate this document in the navigation structure

 

Explanation

In a QUERY expression with at least one 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 ASCII and EBCDIC code attributes can be compared to each other, whereby they are implicitly adapted. Columns with the ASCII code attribute can be compared to date, time, and timestamp specifications. All numbers can be compared to each other. In ANSI SQL mode, it is not enough for the data types and lengths of the specified columns to be compatible: they must match. Moreover, only column specifications or * may be specified in the selected columns of the QUERY specifications linked with UNION. Literals may not be specified.

User Response

Use a QUERY statement issued on the DOMAIN.COLUMNS system table to determine the definition of the affected columns. You may like to try to achieve comparability by using a conversion function. This request cannot be made in ANSI SQL mode.

More Information

SQL reference manual, Data Type, Query Expression