以下查询需要116秒才能显示输出。
我想知道是否有更好的方法来编写下面的代码:
select DP.PARTY_NUMBER
,DP.STATUS
,DP.PARTY_NAME
,DP.ATTRIBUTE14
,hps.party_site_number
,(
select hs.party_name
from ar.hz_parties hs
where hs.party_id = hps.party_id
)REP_NAME,
hps.STATUS
from ar.hz_parties dp
,ar.hz_relationships rl
,ar.hz_party_sites hps
where dp.party_type ='ORGANIZATION'
and dp.status ='A'
and dp.hq_branch_ind ='DP'
and dp.party_id = rl.subject_id(+)
and RL.relationship_code)'GTM_DP_OF_REP_PARTY_SITE'
and rl.status(+) ='A'
and rl.directional_flag(+) ='F'
and trunc(sysdate) between trunc(rl.start_date(+)) and trunc(rl.end_date(+))
and rL.object_id = hps.party_site_id(+);