You may try watching what is returned in $sth->err and $sth->errstr, may contain the id or some indication of the position on the dataset where the error ocurred.

The use of parens around @cols may be redundant and can (IMHO), give troubles as it may be creating an anonymous list (at least it's what it does when you use ($v1,$v2)=sub_returning_array). Also, the use of shift can clarify your code a little. Try:

while(@cols=$sth->fetchrow_array) { $cur_rowid = shift @cols if $row_id; print OFILE join("$delimiter", @cols), "\n"; ] if($sth->err) { print "$sth->errstr\n"; }

Please note that this is a blind shot as I don't have Oracle and, as you may note, I'm just an average Perl programmer, but this may be of help (I think ;)

If that does not give the results you want, you may try using the HandleError hook of DBI. Looking at the documentation it says that the sub defined this way receives, as a third argument, the "first value being returned by the method that failed". Who knows, that may be the rowid you want. ;)

HTH


In reply to Re: get rowid for failed records using dbi by Anonymous Monk
in thread get rowid for failed records using dbi by ctaustin

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.