如果可能的话,请你帮助我,如果为了更快地迭代值,我需要优化下面的代码块。见以下声明:
for CONSULTANT_RECORD IN CONSULTANT_CURSOR LOOP /*Loop 2*/
VData := VData||crlf2||CONSULTANT_RECORD.USER_FIRSTNAME||' '||CONSULTANT_RECORD.USER_SURNAME;
vTOT_LOG_CLOSED4USER := 0;
vAVERAGE_DAY := 0;
vTOT_DAYS := 0;
for x in 1..vlastday loop /*Loop 3*/
select COUNT(DISTINCT LOG_NO) as "LOG_COUNT" INTO vLOG_COUNTER
FROM DMS_CRM.TBL_DMS_SERVICE_REQUESTS_HIST
WHERE LOG_STATUS = 'Resolved'
AND TO_CHAR(HIST_DATE_TIME_STAMP, 'MONTH,YYYY') = TO_CHAR(SYSDATE, 'MONTH,YYYY')
AND TO_CHAR(HIST_DATE_TIME_STAMP, 'DD') = lpad(to_char(x),2,'0')
AND OWNER_USER_ID IS NOT NULL
AND OWNER_USER_ID = CONSULTANT_RECORD.OWNER_USER_ID;
end loop;
END LOOP;
问题开始在评论循环 3 中发生,请记住我正在通过 oracle 应用程序门户进行开发,所以我无法运行查询优化......我的表也被正确索引(如果有人想评论它)。
问候,
PS。没有人用他们的代码版本回复我…………我仍在为此苦苦挣扎:-(