2 angel103108 angel103108 于 2016.01.26 20:13 提问

oracle sql查询语句优化

各位大神,我想问下在生产PLSQL,将****内的注释以后,可以查询出结果(用时:16S秒),否则,SQL就一直处于执行状态,查询不出结果。在线等,求各位大神们解惑

select cs.P_VOICEDIAL_FLAG PVoicedialFlag,
   cs.pri_card_nbr priCardNbr,
   cs.total_bal totalBal,
   cs.overdue_amount totalOdue,
   cs.risk_score riskScore,
   ci.instant_queue_user instantQueueUser,
   ci.assist_user assistUser,
   ci.dept_id dept,
   de.name_ deptName,
   ci.allot_reason allotReason,
   (trunc(ci.close_datetime) - trunc(sysdate) + 1) validateDay,
   cs.ab_branch branch,
   ci.case_business_type caseBusinessType,
 ****  ci.case_list_state caseListSate,--队列名称
   ci.CASE_CODE caseId,--案件编号
   ci.CUST_NAME cName,--客户姓名
        ****
   ci.cust_nbr idNumber,
   ci.instant_queue instantQueue,
   cs.BILL_DATE billingDate,
   cs.total_debt totalAmount,
   cs.MOTHS moths,
   cs.capital capital,
   ci.FOLLOW_DATE followDate,
   cs.PTP_FLAG promiseFlg,
   ci.COLLECTOR currCollector,
   ci.team_code currTeam,
   cs.date_into_collect inputDate,
   ci.ALLOT_DATE alloDate,
   ci.ALLOT_USERNAME alloName,
   ci.model_code modelCode

from armc_case_info ci
left outer join bdf2_dept de
on ci.bank_code = de.company_id_
and ci.dept_id = de.id_
left outer join ARMC_CUST_SUM cs
on ci.bank_code = cs.bank_code
and ci.inst_code = cs.inst_code
and ci.cust_nbr = cs.cust_nbr
and ci.biz_type = cs.biz_type
left outer join ARMC_CASE_STATE st
on ci.bank_code = st.bank_code
and ci.inst_code = st.inst_code
and ci.cust_nbr = st.cust_nbr
and ci.biz_type = st.biz_type
where 1 = 1
and cs.safe_mode_flag = 0
and ci.model_code = 'TDC'
and ci.curr_state = 'OPE'
and ci.case_business_type != 'WITH'
ORDER BY cs.total_debt desc

2个回答

devmiao
devmiao   Ds   Rxr 2016.01.26 23:55
devmiao
devmiao   Ds   Rxr 2016.01.26 23:54
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!