|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Make This Code More efficient
SELECT PROJECT_ID,
SUB_PROJECT_ID, SHORT_NAME, ACTIVITY_SEQ, Prjrep_Timman_API.Get_Job_Name(SHORT_NAME, SHORT_NAME, SHORT_NAME, SHORT_NAME) SHORT_NAME_DESC, '' REPORT_COST_CODE, 0 INTERNAL_QUANTITY, sysdate - 7 ACCOUNT_DATE, OBJID, OBJVERSION FROM activity_ext k WHERE activity_responsible = company_person_API.get_person_id('10', '1036') AND state = activity_api.Finite_State_Decode__('Released') AND (sysdate BETWEEN trunc(early_start) AND trunc(early_finish) OR (early_finish BETWEEN CALENDAR_API.Get_First_Week_Day(sysdate) AND sysdate)) AND 1 NOT IN (select DISTINCT 1 FROM PROJECT_TRANSACTION_NO_ACCESS t WHERE t.company_id = '10' AND t.emp_no = '1036' AND t.account_date BETWEEN CALENDAR_API.Get_First_Week_Day(sysdate) AND CALENDAR_API.Get_Last_Week_Day(sysdate) AND k.activity_seq = t.activity_seq) Can anyone tell me a way to increase the efficiency of the above query segment. Basically I'm looking for more efficient syntax other than IN in that sub query. |
|
#2
|
|||
|
|||
|
What is the sub query supposed to be doing?
|
|
#3
|
|||
|
|||
|
Use 'EXISTS' OPerator
Quote:
Instead of using 'IN' opeartor try to use 'EXISTS' operator so that u will not need to fetch the records from the database. |
|
#4
|
|||
|
|||
|
Lose the
'select DISTINCT 1' as well - make it Code:
SELECT 1 |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Make This Code More efficient |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|