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

Re: DBI Deletes with placeholders

by olus (Curate)
on Feb 04, 2008 at 15:27 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-08-11 01:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found