SOLUTION: ORA-01789 Error in Oracle

Let us see here how to solve ORA-01789 Error Message in Oracle.

ORA-01789 Error Message

You will get below error message once you encounter ORA-01789 error:

ORA-01789: query block has incorrect number of result columns

Cause

Queries joined by UNION or UNION ALL clause do not have same number of columns with same data types. Even if column names are same, different data types will give you below error

Solution

Have same number of columns in queries joined together by UNION or UNION ALL clause.

For example

Error SQL Statement

Change the query by adding one more column in second query of UNION clause.

Correct SQL Statement

Correct the datatypes of columns selected in SELECT statement of UNION query.

Error SQL Statement

Correct SQL statement

Check out all other solutions here.

Hope you like the article and find it useful. We highly appreciate comments and feedback.

You can also Subscribe here to stay updated on latest posts of Oraclemine.com.

Hi I am Paras.

Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at hioraclemine@gmail.com. Again I appreciate your visit. Hope to see you again and again!

Leave a Reply

Your email address will not be published. Required fields are marked *