Learn the cause and how to unravel the ORA-01789 error message in Oracle.
When you come upon an ORA-01789 error, the following error message will appear:
ORA-01789: query block has fallacious number of end result columns
You tried to execute a SELECT assertion (probably a UNION query or a UNION ALL query), and all of the queries did no longer comprise the same quantity of end result columns.
The option(s) to resolve this Oracle error are:
Re-write the SELECT declaration so that every query includes the identical variety of end result columns.
For example, if you tried to execute the following UNION query:
SELECT order_id, quantity FROM orders UNION SELECT order_id FROM orders_audit;
You would receive an error message as follows:
You can right this UNION query by means of having the identical variety of columns in each SELECT’s as follows:
SELECT order_id, quantity FROM orders UNION SELECT order_id, quantity FROM orders_audit;
Remember that the matching columns (from each query) must be the same data types.