Why does oracle not allow the following query
select to_clob(1) from dual
union
select wm_concat(sysdate) from dual;
wm_concat returns a clob. To make both queries in the union have the same type columns i convert the column in the first query to a clob but Oracle gives me an [1]: ORA-00932: inconsistent datatypes: expected - got CLOB error even though both are returning a clob value.
Each of the queries work individually and both return a clob value.
I don’t believe
wm_concatreturns aCLOB.This shows that the return is
Typ=1which is aVARCHAR2which you can also see if you create a view
If you convert the
VARCHAR2returned byWM_CONCATinto aCLOB, the next problem is that Oracle doesn’t support doing aDISTINCTon aCLOBcolumn which is required in order to do aUNION. Assuming that you don’t really need to remove duplicate rows, you can use aUNION ALLrather than aUNION.Putting the two together, something like this
will work