comparing two cursors in oracle instead of using MINUS

Posted by Omnipresent on Stack Overflow See other posts from Stack Overflow or by Omnipresent
Published on 2010-03-22T22:58:17Z Indexed on 2010/03/22 23:01 UTC
Read the original article Hit count: 299

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about Performance