Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UNION ALL in CLOB and VARCHAR data types

inDiscoverFeb 11 2014 — edited Feb 11 2014

Hi All ,

I want to execute the below query but the Oracle is throwing one error.

select comments as cm_comments from table1

union all

select text_action from table2

union all

select notes from table3

union all

select null from table4

Error that I got : ORA-01790: expression must have same datatype as corresponding expression

Here all the columns have the data type of CLOB except the column 'notes' in the table 'table3'. I know this is the reason to get the error but I need a work around for this. One solution I know is that type cast from clob to varchar but in this case there is a chance to trim out the data if the CLOB column contains data whose length is greater than maximum data length allocated to a VARCHAR column.

Please help me in this case to find out a solution for this problem.

Your timely help is well appreciated.

Thanks in advance.

This post has been answered by AnnEdmund on Feb 11 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2014
Added on Feb 11 2014
2 comments
5,455 views