select ID2_DTS from rsm_datasource_xl
where id2_dts in 
(select ''''||replace(substr(dts_rule,1,length(dts_rule)-1),',',''',''')||'''' from rsm_dsrule where id_rule = '73')select ''''||replace(substr(dts_rule,1,length(dts_rule)-1),',',''',''')||'''' from rsm_dsrule where id_rule = '73' 是有值的 结果:'010101','010102','010103'但第一个语句执行没结果。为什么??

解决方案 »

  1.   


    in('010101','010102','010103')--此處的是一個集合--而你的寫法
    (select ''''||replace(substr(dts_rule,1,length(dts_rule)-1),',',''',''')||'''' from rsm_dsrule where id_rule = '73')---等同於,此處是一個字符串
    in('...')--兩者意義完全不同
      

  2.   


    select ID2_DTS from rsm_datasource_xl
    where id2_dts in  
    ('010101','010102','010103')
    这样再试试不就行了。