作者:iamlaosong
一條的SQL查詢語句,執行成功或者報錯,與語句無關,卻與條件中的值有關,錯誤是ORA-03113: 通信通道的文件結束,是不是很奇怪,語句如下:
select * from tb_evt_dlv a, tb_jg b,tb_evt_mail_clct c where a.mail_num=c.mail_num and a.dlv_date between to_date('2014-11-1','yyyy-mm-dd') and to_date('2014-11-1','yyyy-mm-dd') and a.dlv_sts_code='I' and a.dlv_bureau_org_code =b.zj_code and a.dlv_bureau_org_code like '23009201%' order by b.city,b.ssxs,b.zj_code,a.dlv_date
錯誤如下圖一,關閉圖一,出現圖二:
這個錯誤肯定與通信沒有關系,這個錯誤以前也碰到過,當時條件是“23007300”,這個機構依然報錯,不過只在關聯sncn_zd_jg這個表時報錯,現在又發現“23009201”也報錯,比那個還嚴重,更換機構表tb_jg和sncn_zd_jg都報錯(參見:一個奇怪的查詢語句(不知原因)),很是奇怪。
將‘23009201%’改成‘230092%’,或者直接將like ‘23009201%’換成=‘23009201’都可以成功執行。如下:
select * from tb_evt_dlv a, tb_jg b,tb_evt_mail_clct c where a.mail_num=c.mail_num and a.dlv_date between to_date('2014-12-10','yyyy-mm-dd') and to_date('2014-12-10','yyyy-mm-dd') and a.dlv_sts_code='I' and a.dlv_bureau_org_code =b.zj_code and a.dlv_bureau_org_code = '23009201' order by b.city,b.ssxs,b.zj_code,a.dlv_date
去掉最後一個表,改成下面的語句也可以成功執行。如下:
select * from tb_evt_dlv a, tb_jg b where a.dlv_date between to_date('2014-12-10','yyyy-mm-dd') and to_date('2014-12-10','yyyy-mm-dd') and a.dlv_sts_code='I' and a.dlv_bureau_org_code =b.zj_code and a.dlv_bureau_org_code like '23009201%' order by b.city,b.ssxs,b.zj_code,a.dlv_date
按照以前的經驗,用下面語句重新創建tb_jg和sncn_zd_jg,上述錯誤不再出現。
rename tb_jg to tb_jg1; create table tb_jg as select * from tb_jg1;
只是依然不知原因何在?難道這些表是亞健康?或者是增加這兩天記錄時留下了什麼暗疾?