码农_Aaron 2014-04-17 02:52
浏览 750

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)
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换