#!/usr/bin/perl5.10 -w
use warnings;
use strict;
use Spreadsheet::ParseExcel;
use IO::Scalar;
use Data::Dumper;
use DBI;
use DBD::MSDB2;
my $curr_etl = "wf_OTC_Taxlots_Open";
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse("/ms/user/s/sayantag/Source.xls");
my $worksheet1 = $workbook->Worksheet("WF");
#my $worksheet2 = $workbook->Worksheet("Calc");
print $worksheet1;
for $worksheet1 ( $workbook->worksheets() ) {
my ( $row_min, $row_max ) = $worksheet1->row_range();
my ( $col_min, $col_max ) = $worksheet1->col_range();
for my $row ( $row_min .. $row_max ) {##First for##
for my $col ( $col_min .. $col_max ) {##Second for##
my $cell = $worksheet1->get_cell( $row, $col );
if ($col==0 && $row !=0 && ($worksheet1->get_cell($row, 0)->value eq "$curr_etl")) {
$col++;
my $src_id = $worksheet1->get_cell($row, $col)->value;
print $src_id;
my $dbh = DBI->connect('dbi:MSDB2:NQ200001', '', '', { 'RaiseError' => 1 }) or
die "Can't connect to database: $DBI::errstr";
$dbh->do(delete from pfnd.funding_journal_vw fj where fj.SRC_ID = "$src_id"));
$dbh->disconnect;
$workbook->close();
}
}
}
}
|