#!/cluster/uapp/perl/bin/perl -w use KAP; #internally developed library. use strict; use Date::Manip; #internally developed library. use DBAccess; use EQ_Misc; #internally developed library. use DBD::CSV; use MIME::Lite; use Net::SMTP; use Data::Dumper; my $_db_lv_conn_file = "MSLV.eq_script_user"; my $_read_dbi = undef; # Run stored proc my $sp = "lv..check_tax_lot"; #The stored procedure that I am running, which returns me 7 resultset. KAP::write_log("Preparing $sp");#To write log $_read_dbi = KAP::opendbi($_db_lv_conn_file) || handle_error_and_exit ("Failed to get a connection to MSLV db server"); # To connect to the database my $_read_sth = $_read_dbi->prepare($sp); if($DBI::err) { handle_error_and_exit("**ERROR preparing $sp: " . $DBI::errstr); } KAP::write_log("Prepare done, executing $sp");#To write log $_read_sth->execute(); if($DBI::err) { handle_error_and_exit( "**ERROR executing $sp: " . $DBI::errstr); } KAP::write_log("Execute of $sp done");#To write the log do { my $row = $_read_sth->fetchrow_arrayref(); print Dumper $row; } while ($_read_sth->{syb_more_results});