-
Decode Function issue
Hi all,
i want compare two rows in a table. so i used decode function to compare the values, whther its matched or not.
One of my table column has Long data type.
Decode(a.col1,b.col1,'Match','NotMatch')
col1 - is long data type.
when i use long data type, i got below error,
is there anyway to rectify this error.
SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
00932. 00000 - "inconsistent datatypes: expected %s got %s"
Thanks in advance.
Regards,
Santhosh
-
LONG columns are pretty restictive, one of the restrictions is that they cannot be used on built-in functions.
-
Try using the to_clob() function, and then you can also use all of the methods of dbms_lob. As in:
select dbms_lob.compare(to_clob(tab_a.mycolumn), to_clob(tab_b.mycolumn))
from table_a
inner join table_b
on table_a.pkey = table_b.pkey
where table_a.pkey.123456;