comparing two cursors in oracle instead of using MINUS
- by Omnipresent
The following query takes more than 3 minutes to run because tables contain massive amounts of data:
SELECT RTRIM(LTRIM(A.HEAD)),
A.EFFECTIVE_DATE,
FROM TABLE_1 A
WHERE A.TYPE_OF_ACTION='6'
AND A.EFFECTIVE_DATE >= ADD_MONTHS(SYSDATE,-15)
MINUS
SELECT RTRIM(LTRIM(B.head)),
B.EFFECTIVE_DATE,
FROM TABLE_2 B
In our system a query gets killed if it is running for more than 8 seconds. Is there a way to run the queries individually ..put them in cursors..compare and then get the results? that way each query will be ran individually rather than as one massive query which takes 3 minutes.
How would two cursors be compared to mimic the MINUS?