View previous topic :: View next topic
|
Author |
Message |
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi,
I have the below cursor which takes more time to fetch.Could anyone suggest how t optimise the cursor.
EXEC SQL DECLARE CURS-EPCF CURSOR FOR
SELECT EPCF_REF,
EPCF_CPT_CLI,
EPCF_CPT_FOUR,
EPCF_CD_TYP_SOLLOG
FROM TDEPCF
WHERE ( (EPCF_CPT_CLI = :SYS-USINE AND
(EPCF_CD_TYP_SOLLOG = 'E' OR
EPCF_CD_TYP_SOLLOG = 'I' ))
OR
(EPCF_CPT_FOUR = :SYS-USINE AND
EPCF_CD_TYP_SOLLOG = 'S' ) )
AND EPCF_DT_APPLI <= :W-TIMESTAMP
AND EPCF_DT_FIN > :W-DT-TRT
AND EPCF_CD_LOCA = :EPCF-CD-LOCA
FOR FETCH ONLY
END-EXEC.
Thanks in advance.
Regards,
Rajan BOSE |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
h
Quote: |
ave the below cursor which takes more time to fetch |
explain please ... more than what ??? |
|
Back to top |
|
|
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi,
As per my understanding the fetch takes more time in the below step
WHERE ( (EPCF_CPT_CLI = :SYS-USINE AND
(EPCF_CD_TYP_SOLLOG = 'E' OR
EPCF_CD_TYP_SOLLOG = 'I' ))
OR
(EPCF_CPT_FOUR = :SYS-USINE AND
EPCF_CD_TYP_SOLLOG = 'S' ) )
Is there any other optimised way to declare the cursor? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
more time to fetch |
than what?
run your select thru explain and work with the output to 'optimize' your sql. |
|
Back to top |
|
|
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi Dick,
Thanks.I have solved the problem. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Perhaps you may wish to post the resolution - in the vain hope that someone else with a similar question might actaully use the search button |
|
Back to top |
|
|
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi,
Sorry for the late response.I haave created a new index to solve my problem.
Regards,
Rajan BOSE. |
|
Back to top |
|
|
|