Oracle/PLSQL: ORA-01790 Error
ORA-01790: expression must have same datatype as corresponding expression
Cause of Error
The option(s) to resolve this Oracle error are:
Re-write the SELECT statement so that each matching column is the same data type.
For example, if you tried to execute the following UNION query:
select supplier_name from orders UNION select quantity from orders_audit;
You would receive an error message as follows:
Since the supplier_name column is defined as a varchar2 and the quantity column is defined as a number, these columns can not be matching columns.
select supplier_name from orders UNION select to_char(quantity) from orders_audit;
In this example, we've used the to_char function to convert the quantity column to a data type that is compatible with the supplier_name column.