Just a thought for you: if you don't really need to know whether or not the row you are attempting to update exists or not, then just update it:
my $sth = $dbh->prepare(" UPDATE many_address SET name=NULL, date_loaded=NULL WHERE name=? AND number=? AND street=? "); while (<RA>) { my ($name,$add,$street) = split(/\|/,$_); chomp($street); $sth->execute($name,$add,$street); }
SQL doesn't care. If the name, address, and street don't match any existing record, then the update will not happen. Of course, for proper error checking my suggestion may not be helpful, but i still thought i should put this thought in your mind anyway. ;)

P.S. Get out of the habit of using NULL now, before it is too late! Use another field named 'status' if you are wanting to 'delete' a record without removing it from the table.

UPDATE:
Well, there is a way to find out if a row was updated or not, but you have to use do() instead, thus giving up your placeholders. From the docs:

$rows_affected = $dbh->do("UPDATE your_table SET foo = foo + 1");
UPDATE x 2:
Thanks iburrell and mpeppler. execute indeeds returns the number of rows updated or the value 0E0 (which means zero but not true - typos: sigh, thanks grantm!) if no rows were updated (it will return -1 if there is an error). Here is an update of the above code:
... while (<RA>) { my ($name,$add,$street) = split(/\|/,$_); chomp($street); my $ret = $sth->execute($name,$add,$street); print "no update for $name\n" if $ret == 0; }

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: DBI multiple prepares by jeffa
in thread DBI multiple prepares by vivekvp

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.