Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: DBI Deletes with placeholders

by olus (Curate)
on Feb 04, 2008 at 15:27 UTC ( [id://665981]=note: print w/replies, xml ) Need Help??


in reply to DBI Deletes with placeholders

Deletes with placeholders are possible with prepare/execute and do ways.

Like talexb said, you should get the error message from the driver, and with that you could get a better hint on what went wrong.

my $qry = "delete from my_table where id=?"; my $sth = $dbh->prepare($qry); $sth->execute($value_to_delete) or die DBI->errstr; print "deleted rows = ".$sth->rows; $sth->finish;

To do the same but using bind values with the do method you can

my $qry = "delete from my_table where id=?"; $dbh->do($qry, undef, $value_to_delete);
Also, id is an Oracle reserved word and you should avoid using it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://665981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (None)
    As of 2024-04-25 01:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found