sduser1
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:Ora cle:host=f it.fmr.com ;port=1521 ;service_n ame=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
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use DBD::Oracle;
my $dbh=DBI->connect("dbi:Ora
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does the table have any foreign key constraints? If so, it could be failing due to those constraints.
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.