My program uses Perl DBI to connect to Oracle database, I have an strange issue as explained below-

I have a select query in my program, which uses to compare data between two dates (start date and end date)and selects it,

( WHERE REC_STATUS = 'A' and UCSIIU_RECEIPT_AT_MOT_DT between to_date( +? ,'mm/dd/yyyy') and to_date(?,'MM/DD/YYYY ) ) OR (UCSIIU_RECEIPT_AT_MOT_DT between to_date(?,'mm/dd/yyyy') and to_da +te(?,'MM/DD/YYYY) AND REC_STATUS = 'I'))

I found that when I pass these four parameters as variable (using bind_param function), the perl script is taking four to five hours to execute the query ($sth->execute) in the perl script, however when I hard code these parameters (dates) in the select query this query is executed within ten minutes of time.

In brief when I hard code the date parameters inside query the perl script takes 10 to 15 min to execute, but if I pass date parameters as variables this script is talking more than five hours to execute, it hangs in a single ,step $sth->execute for a very long tome.

I am unable to get the cause of this problem; your suggestion to this problem is heartily welcome.

Thanks in advance,
Ram

20060925 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

2006-09-25 Retitled by GrandFather, as per Monastery guidelines
Original title: 'Hi Monks,'


In reply to Excessive execution time passing parameters to Oracle by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.