select T1.TDDOC, T1.tddsc1, t1.tddsc2, t1.tddsc, t1.uorg, t1.tuprc, t1.taexp, t1.THDC5801, t1.tddoco, t1.thflag, t1.tdtxa1, t1.tdflag, t1.THSTRING01, t2.tdtxa2, t3.mcu, trim(c.abalph) as abalph, t1.thalph from (select trim(t1.tddoc) as tddoc, trim(t1.tddsc1) AS tddsc1, trim(t1.tddsc2) as tddsc2, trim(t1.tddsc) as tddsc, T1.TDUORG / 10000 as uorg, T1.TDTUPRC / 10000 as tuprc, T1.TDTAEXP / 100 as taexp, trim(T.THDC5801) as THDC5801, t1.tddoco, t.thflag, t1.tdtxa1, trim(t.thalph) as thalph, t1.tdflag, T.THSTRING01 from proddta.f5842001 t left join proddta.f5842002 t1 on t.thdoc = t1.tddoc where tdchar01 <> 'N' ) t1 left join (select tddoc, listagg(to_char(tdtxa1), ' ') WITHIN GROUP(ORDER BY tdtxa1) AS tdtxa2 from (select distinct tddoc, concat(SUBSTR(trIM(tdtxa1), 2, 2), '%') as tdtxa1 from proddta.f5842002) group by tddoc) t2 on t1.tddoc = t2.tddoc left join (select tddoc, listagg(to_char(tdmcu), ' ') WITHIN GROUP(ORDER BY tdmcu) AS mcu from (select distinct tddoc, trIM(tdmcu) as tdmcu from proddta.f5842002) group by tddoc) t3 on t1.tddoc = t3.tddoc left join sy920.f0092 b on T1.thstring01 = b.uluser left join proddta.f0101 c on b.ulan8 = c.aban8 order by t1.tddoc, t1.tdtxa1 thstring01 是nchar(30) uluser是nchar(10) 不知道是怎么回事,在线等挺急的。 语句本身没有问题。是用于条件筛选的语句导致的。用了to_number也报数字无效。 and 1=1 ${if(len(单据号)==0,"","and T.tHdoc=to_number('"+单据号+"')")} and 1=1 ${if(len(单据号上)==0,"","and t.tHdoc>to_number('"+单据号上+"')")} and 1=1 ${if(len(单据号下)==0,"","and t.tHdoc<to_number('"+单据号下+"')")} |