在oracle 11.2.0.1.0 在sql语句中使用with table as 写法时触发了ora-03113错误
insur_name as center_name,
sum(total_pay) as total_money,
sum(fund_pay) as fund_money,
sum(total_pay_tekun) as total_money_tekun,
sum(fund_pay_tekun) as fund_money_tekun,
(select nvl(max(akb070), 0) from kf21 where aaz272 = pay_bill_no) +
(select nvl(sum(AKB069), 0) from kcb5 where aaz272 = pay_bill_no) akb070,
(select nvl(max(bkb070), 0) from kf21 where aaz272 = pay_bill_no) bkb070
from (with abcd as (select decode(a.bac004, '2', 1, 0) as bac004,
decode(b.aka042, 'E', '是', '否') as twice_inhosp_flag,
sum(c.aae019) as total_pay,
decode(a.bac004, '2', sum(c.aae019), 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(n.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd'))),
ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
where b.aac001 = a.aac001
and decode(z.aac066, '1', '311', z.aac066) =
and nvl(m.aae167, 0) >= 0
and (m.aka035 = y.aka035a or y.aka035a = d.aka120)
('440999', '440901', '440902', '440903')
select decode(a.bac004, '2', 1, 0) as bac004,
decode(d.aka042, 'E', '是', '否') as twice_inhosp_flag,
decode(a.bac004, '2', d.aae198, 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(f.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd'))),
ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
(select ac20.aac001, ae10.aab069
where ae10.aaz001 = ac20.aab001
and ac20.aae140 = '310') t1
where c.aaz269 = e.Aaz001
and nvl(d.aae167, 0) >= 0
and d.aac066 = t.aaa102(+)
and (d.aka035 = y.aka035a or b.aka120 = y.aka035a)
and d.aaz272 = 8180), abc as (select count(distinct
where abc.insur_name = abcd.insur_name
and abc.pers_name = abcd.pers_name
and abc.aka035 = abcd.aka035
and abc.aaa027 = abcd.aaa027)
order by aaa027, pers_name desc;
上面是报ora-03113故障的语句使用了with table as 写法
经过修改语句去掉with table as 写法后正常执行
insur_name as center_name,
sum(total_pay) as total_money,
sum(fund_pay) as fund_money,
sum(total_pay_tekun) as total_money_tekun,
sum(fund_pay_tekun) as fund_money_tekun,
(select nvl(max(akb070), 0) from kf21 where aaz272 = pay_bill_no) +
(select nvl(sum(AKB069), 0) from kcb5 where aaz272 = pay_bill_no) akb070,
(select nvl(max(bkb070), 0) from kf21 where aaz272 = pay_bill_no) bkb070
select decode(a.bac004, '2', 1, 0) as bac004,
decode(b.aka042, 'E', '是', '否') as twice_inhosp_flag,
sum(c.aae019) as total_pay,
decode(a.bac004, '2', sum(c.aae019), 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(n.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd'))),
ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
where b.aac001 = a.aac001
and decode(z.aac066, '1', '311', z.aac066) =
and nvl(m.aae167, 0) >= 0
and (m.aka035 = y.aka035a or y.aka035a = d.aka120)
('440999', '440901', '440902', '440903')
select decode(a.bac004, '2', 1, 0) as bac004,
decode(d.aka042, 'E', '是', '否') as twice_inhosp_flag,
decode(a.bac004, '2', d.aae198, 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(f.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd'))),
ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
(select ac20.aac001, ae10.aab069
where ae10.aaz001 = ac20.aab001
and ac20.aae140 = '310') t1
where c.aaz269 = e.Aaz001
and nvl(d.aae167, 0) >= 0
and d.aac066 = t.aaa102(+)
and (d.aka035 = y.aka035a or b.aka120 = y.aka035a)
(select decode(a.bac004, '2', 1, 0) as bac004,
decode(b.aka042, 'E', '是', '否') as twice_inhosp_flag,
sum(c.aae019) as total_pay,
decode(a.bac004, '2', sum(c.aae019), 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(n.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd'))),
ceil(trunc(to_date(h.aae031, 'yyyymmdd')) -
trunc(to_date(h.aae030, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
where b.aac001 = a.aac001
and decode(z.aac066, '1', '311', z.aac066) =
and nvl(m.aae167, 0) >= 0
and (m.aka035 = y.aka035a or y.aka035a = d.aka120)
('440999', '440901', '440902', '440903')
select decode(a.bac004, '2', 1, 0) as bac004,
decode(d.aka042, 'E', '是', '否') as twice_inhosp_flag,
decode(a.bac004, '2', d.aae198, 0) as total_pay_tekun,
e.aab069 as hospital_name,
to_char(f.aae015, 'yyyy-mm-dd') as check_date,
decode(ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd'))),
ceil(trunc(to_date(d.aae042, 'yyyymmdd')) -
trunc(to_date(d.aae041, 'yyyymmdd')))) as days
(select decode(y.aka120, '', y.aka035, y.aka120) as aka035a,
group by decode(y.aka120,
(select ac20.aac001, ae10.aab069
where ae10.aaz001 = ac20.aab001
and ac20.aae140 = '310') t1
where c.aaz269 = e.Aaz001
and nvl(d.aae167, 0) >= 0
and d.aac066 = t.aaa102(+)
and (d.aka035 = y.aka035a or b.aka120 = y.aka035a)
where abc.insur_name = abcd.insur_name
and abc.pers_name = abcd.pers_name
and abc.aka035 = abcd.aka035
and abc.aaa027 = abcd.aaa027)
order by aaa027, pers_name desc;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26015009/viewspace-757635/,如需转载,请注明出处,否则将追究法律责任。