ORA-12704: character set mismatch問題、以及處理wm_concat函式clob亂碼問題
阿新 • • 發佈:2019-02-06
<pre name="code" class="html">
在utf8資料庫裡編譯儲存過程,遇到這個問題.
oracle9206
sql: [做了簡化]
select a from t1
union all
select '1' from t2;
其中t1.a是nvarchar2型別。
解決辦法很簡單:
select a from t1
union all
select N'1' from t2;
==============================================================
select em.devicename, to_char(em.faulttime, 'yyyy-mm-dd hh24:mi:ss') faulttime, et.enumname maintainstatus, (case when (em.DPLANREPAIRTIME >= em.drealrepairtime) or (sysdate < em.dplanrepairtime) then '及時' when (em.dplanrepairtime < em.drealrepairtime) or (em.drealrepairtime is null and em.dplanrepairtime < sysdate) then '不及時' when (em.dplanrepairtime is null and em.drealrepairtime is null and (em.faulttime + esl.finishtime / 24) > sysdate) then '及時' when (em.dplanrepairtime is null and em.drealrepairtime is null and (em.faulttime + esl.finishtime / 24) < sysdate) then '不及時' end) overdue, et1.enumname faultfrom, em.CBUGDETAIL, to_char((select wm_concat(to_char(eti.track_time, 'yyyy-mm-dd hh24:mi:ss') || ' ' || eti.track_info || '【' || eti.track_man || '】') from equip_maintain_tracking_info eti where eti.maintain_id = em.maintainid)) genjin, et2.enumname resultstatus, to_char(em.drealrepairtime, 'yyyy-mm-dd hh24:mi:ss') nworkhour, (case when sps.connection_name is null then '' else sps.connection_name || '-' || sps.connection_phone end) crepairid, et3.enumname faulttype from equip_maintain em left join enum_type et on et.enumvalue = em.maintain_status and et.enumtypeid = '75' left join enum_type et1 on et1.enumvalue = em.fault_from and et1.enumtypeid = '74' left join enum_type et2 on et2.enumvalue = em.result_status and et2.enumtypeid = '76' left join equip_service_level esl on esl.name = em.service_level left join Equip_Service_Provider_Sms sps on sps.id = em.crepairid left join enum_type et3 on em.fault_type = et3.enumvalue and et3.enumtypeid = '77' where em.cequipid = '370200000000080004' and (em.result_status = 1 or em.result_status is null) and em.faulttime >= to_date('20151127', 'yyyymmdd') and em.faulttime <= to_date('20151226235959', 'yyyymmddhh24miss') order by em.faulttime desc