我刚刚注意到FULL OUTER JOIN
不在Oracle中工作。
其他查询工作正常,但是当我使用完全外连接触发查询时,它需要时间并且断开连接并抛出错误。
ORA-03113: 通信通道上的文件结尾
RIGHT OUTER JOIN和LEFT OUTER JOIN工作正常。
对于下面我使用完全外连接获取所有记录的查询,有什么替代方法?
select * from
(
select
FTM_OFFICE_ID,
NVL(SUM(FTD_NRS_AMOUNT),0) as TOTAL
from FMS_TRANS_DTL
inner join FMS_TRANS_MST ON FMS_TRANS_MST.FTM_TRANS_MST_ID = FMS_TRANS_DTL.FTD_TRANS_MST_ID
inner join FMS_FC_VOUCHER_CONFIG ON FMS_FC_VOUCHER_CONFIG.FFVC_VOUCHER_ID = FMS_TRANS_MST.FTM_VOUCHER_ID
where FFVC_ACCOUNT_TYPE = 3 and FTM_FISCAL_YEAR='2066/67'
and FTD_ACC_ID in (select distinct FDP_DHARAUTI_C_ACC_ID from FMS_DHARAUTI_PARAMETER where FDP_FISCAL_YEAR='2066/67' )
/*and FTD_ACC_ID in (591)*/
group by FTM_OFFICE_ID
) T1
full outer join
(
select
FTM_OFFICE_ID,
NVL(SUM(FTD_NRS_AMOUNT),0) as TOTAL
from FMS_TRANS_DTL
inner join FMS_TRANS_MST ON FMS_TRANS_MST.FTM_TRANS_MST_ID = FMS_TRANS_DTL.FTD_TRANS_MST_ID
inner join FMS_FC_VOUCHER_CONFIG ON FMS_FC_VOUCHER_CONFIG.FFVC_VOUCHER_ID = FMS_TRANS_MST.FTM_VOUCHER_ID
where FFVC_ACCOUNT_TYPE = 3 and FTM_FISCAL_YEAR='2066/67'
/*and FTD_ACC_ID in (592)*/
and FTD_ACC_ID in
(select distinct FDP_DHARAUTI_L_ACC_ID from FMS_DHARAUTI_PARAMETER where FDP_FISCAL_YEAR='2066/67' )
group by FTM_OFFICE_ID
) T2
on T1.FTM_OFFICE_ID=T2.FTM_OFFICE_ID
/*
The no. of rows that T1 can have can be different that no. of rows T2 can have.
Its not necessary any OFFICE_ID must have amount under any FTD_ACC_ID.
*/
刚刚注意到,如果我删除条件 for 中的子查询FTD_ACC_ID
,查询运行完美。为什么 ?