oracle 嵌套循环优化问题
for acct in (select ucracct_cust_code,
ucracct_prem_code,
ucracct_cycl_code,
ucracct_status_ind
from ucracct -------数据50万
where ucracct_cycl_code>=vcycle_code_begin
and ucracct_cycl_code<=vcycle_code_end
and (vacct_type='%' or ucracct_status_ind=vacct_type)
)
loop
if mod(vrows,vinterval)=0 then
for shis in ( select urrshis_serv_num,
urrshis_styp_code,
urrshis_scat_code,
urrshis_action_date,
urrshis_actn_code,
urrshis_rtyp_code,
urrshis_reading,
urrshis_multiplier,
urrshis_consumption,
urrshis_dos,
urrshis_charge_date,
urrshis_chrg_calc_num
from urrshis ---数据上千万
where urrshis_prem_code=acct.ucracct_prem_code
and urrshis_cust_code=acct.ucracct_cust_code
and urrshis_action_date < sysdate - 45
and nvl(urrshis_actn_code,'*')<>'SKIP'
and nvl(urrshis_charge_date,to_date('12/31/2099','mm-dd-yyyy')) = to_date('12/31/2099','mm-dd-yyyy')
)
loop
...
这样的嵌套循环,如何优化呢??不能写成sql,不能动数据库结构。望达人相助。