4 Replies Latest reply on Feb 12, 2013 12:19 PM by 937157

    Query Running Slow due to nvl.

    937157
      I have a Cursor Based query written as a Procedure.when i invoke that procedure,I found that two condition statements are the ones which is making my query run very slow.

      Since this has been handled with NVL statements query is running very slow.Currently query takes more than one hour to execute.if i comment these two statements and run the query,it takes ony 20 secs to complete.

      Those two statements are

      'and rbsa.batch_source_id = nvl(p_source_type_id, rbsa.batch_source_id)'

      'and rsa.salesrep_id between nvl(p_from_salesrep_id, rsa.salesrep_id) and nvl(p_to_salesrep_id, rsa.salesrep_id)'

      Is there any other alternative to replace these two statements by other means.


      Thanks in Advance...