Union causing an ORA-01790: expression must have same datatype as corresponding expression
问题 With the following query as an example: select p.product_id, p.product_name, product_type as product_type, from products group by p.product_id, p.product_name union select p.product_id, p.product_name, cast(collect(coalesce(product_type, decode(product_description,null,'DESCR' || '-' product_description) as my_type) as product_type, from products group by p.product_id, p.product_name The select statement in the first query returns product_type as a varchar and on the second query product_type