#!/cluster/uapp/perl/bin/perl -w use DBI; use strict; use DBAccess; use DBD::CSV; use MIME::Lite; use Net::SMTP; use Data::Dumper; use Text::CSV_XS; my @ret_values = undef; ##Parameters to connect to the Database here##### # Run stored proc my $sp = "lv..check_tax_lot"; $_read_dbi = ###Make Database Connection here### my $_read_sth = $_read_dbi->prepare($sp); if($DBI::err) { handle_error_and_exit("**ERROR preparing $sp: " . $DBI::errstr); } $_read_sth->execute(); if($DBI::err) { handle_error_and_exit( "**ERROR executing $sp: " . $DBI::errstr); } while (my $row = $_read_sth->fetchall_arrayref) { my $csv = Text::CSV_XS->new ({ binary => 1, eol => "\r\n" }); print @{$_read_sth->{NAME}}; while (my $r = $_read_sth->fetch) { $csv->print (*STDOUT, $r); } }