我正在尝试执行以下查询:
select * from trgdms.src_stm where trim(src_stm_code) in (select concat (concat('''', trim(replace(processed_src_sys_cd,',',''','''))),'''' ) from trgdms.batch_run_log where src_stm_cd_or_hub_cd='CTR' and file_process_dt='2015-06-19' and batch_id=42);
表 trgdms.src_stm 的 src_stm_code 列具有 T19、T68、T73 等值。当我单独运行内部查询时,我确实得到了正确的结果:
select concat (concat('''', trim(replace(processed_src_sys_cd,',',''','''))),'''' ) from trgdms.batch_run_log where src_stm_cd_or_hub_cd='CTR' and file_process_dt='2015-06-19' and batch_id=42
结果:'T19','T68','T73'
想知道是否有人在 db2 中使用过类似的东西?