delete query using perl dbi

I am having an issue with delete when I use the below code to delete the data from the table.


use strict;
use warnings;
use DBI;
use DBD::Oracle;

my $dbh=DBI->connect(";port=1521;service_name=user1","passwd1", "userdev");

my $rows = $dbh->do("DELETE from cnv_batches where PROJECT_CD='METLIFE'");
 print "Number of rows deleted: $rows";

when I run the above script I get the below error.  No rows are deleted.

Number of rows deleted: 0E0
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Start by adding error checking/handling on the DB calls.

Then run a select statement using the exact same from and where clause either from within the script or directly from the cli to verify that it returns the expected records.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Does the table have any foreign key constraints?  If so, it could be failing due to those constraints.
sduser1Author Commented:
Sorry for the delay. I was out for few days. The query was going to the wrong db. The select statement helped in figuring out.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.