I have an issue whith this query which doesn't work :
select count(*)
from MYTABLE where
MYFIELD in (select trim(cast(CLOBFIELD as varchar(20000))) from TABLE2) ;
=>0 rows
The subquery return right results :
select trim(cast(CLOBFIELD as varchar(20000))) from TABLE2 ;
=>1202,1203,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1226
This query which doesn't have the subquery returns right reusults.
select count(*)
from MYTABLE where
MYFIELD in (1202,1203,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1226) ;
The column CLOBFIELD is a CLOB field VS the column is a char(4) field. In my opinion, this a cast issue in the subquery because of the cast on the clob field. I don't know what's wrong, I am not very familar with DB2, does anybody can help me ?