Link to home
Start Free TrialLog in
Avatar of sduser1
sduser1Flag for United States of America

asked on

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.

#!/usr/bin/perl

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


my $dbh=DBI->connect("dbi:Oracle:host=fit.fmr.com;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";
 
$dbh->disconnect();

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

Number of rows deleted: 0E0
ASKER CERTIFIED SOLUTION
Avatar of FishMonger
FishMonger
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does the table have any foreign key constraints?  If so, it could be failing due to those constraints.
Avatar of sduser1

ASKER

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.