2 aaron shi aaron_shi 于 2014.04.17 10:52 提问

sql 调优 oracle 执行速度再快一点
select psf.pol_num, psf.bank_acct_num, cba_dda.bank_acct_nm
from   tbank_pos_slip_files psf, tclient_policy_links cpl_dda, tclient_bank_accounts cba_dda
where  cpl_dda.cli_num = cba_dda.cli_num
and    cpl_dda.bank_acct_typ = cba_dda.bank_acct_typ
and    cpl_dda.link_typ = 'O'
and    psf.bank_acct_num = cba_dda.bank_acct_num
and    psf.trade_role = 'C'
and    psf.mtch_ind = 'Y'
and    psf.mtch_dt between to_date('2013/11/01', 'yyyy/mm/dd') and to_date('2013/11/30', 'yyyy/mm/dd')
      --and (p_terr_cd = '*' or instr(p_terr_cd, psf.pos_terr_cd ||'/') > 0)
and    not exists (select 'Y'
        from   tclient_policy_links cpl, tclient_details cli
        where  cpl.cli_num = cli.cli_num
        and    cpl.link_typ in ('I', 'O')
        and    cpl.pol_num = psf.pol_num
        and    cli.cli_nm = cba_dda.bank_acct_nm
        union all
        select 'Y'
        from   tbeneficiary_details bft
        where  bft.pol_num = psf.pol_num
        and    bft.bnfy_nm = cba_dda.bank_acct_nm)
union
select psf.pol_num, psf.bank_acct_num, cba_dca.bank_acct_nm
from   tbank_pos_slip_files psf, vclient_policy_links cpl_dca, tclient_bank_accounts cba_dca
where  cpl_dca.cli_num = cba_dca.cli_num
and    cpl_dca.payo_bank_acct_typ = cba_dca.bank_acct_typ
and    psf.bank_acct_num = cba_dca.bank_acct_num
and    psf.trade_role = 'C'
and    psf.mtch_ind = 'Y'
and    psf.mtch_dt between to_date('2013/11/01', 'yyyy/mm/dd') and to_date('2013/11/30', 'yyyy/mm/dd')
      --and (p_terr_cd = '*' or instr(p_terr_cd, psf.pos_terr_cd ||'/') > 0)
and    not exists (select 'Y'
        from   tclient_policy_links cpl, tclient_details cli
        where  cpl.cli_num = cli.cli_num
        and    cpl.link_typ in ('I', 'O')
        and    cpl.pol_num = psf.pol_num
        and    cli.cli_nm = cba_dca.bank_acct_nm
        union all
        select 'Y'
        from   tbeneficiary_details bft
        where  bft.pol_num = psf.pol_num
        and    bft.bnfy_nm = cba_dca.bank_acct_nm)
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!