We have a script that builds a dynamic query to our database. Then it prepares and executes the query as follows:
my $sth = $dbh->prepare("$Select_Statement"); $sth->execute();
At this point, I print out the sql statement so I can run it myself directly through another DBI interface. SO that output may look like this:
select severity,class,status,date_event,hostname,msg,administrator,sou +rce,sub_source,rep.server_hndl,rep.event_hndl,rep.date_reception from + tec_t_evt_rep rep where rep.date_reception > 1157568225 and rep.date +_reception < 1157568525 and ( hostname like '%aixjcsa1%' )
Now, my printing of the sql statement notwithstanding, the program proceeds to step through the results of the sql statement as follows:
while (@data = $sth->fetchrow_array) { bleh blah bleh }
There are no conditions inside the code block to drop or next on any records. In fact, I'd added a line at the very first line in the while statement to print @data for my troubleshooting processes.
Okay, so the net result here is that if I run the sql_statement in my own DBI script I get records that do not return in the fetchrow_array loop.
I can only assume that the fetchrow is dropping them for some reason.
This process was working until a few weeks ago and we can't determine any reasonable correlation between this changing and other changes we've made.
Any ideas?

In reply to fetchrow_array does not yield the same results as the sql query by itself does. by gator_shawn

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.