I have tables that are in 2 different schemas, so I need to start with one login, which is the outter loop. Then I need to login and connect to the other schema and read 3 tables.
I am trying to get the code to handle the inner login without dropping the outter login.
Here is the code:
I will work on the array after I get the inner loop working. The outter loop is working just fine.
I get this output:
I am trying to get the code to handle the inner login without dropping the outter login.
Here is the code:
Code:
## read table procure.recpo and process each entry
use DBI;
$dbh = DBI->connect($dsn, $user, $password)
or die "Couldn't connect to DB: " . DBI->errstr;
$sth = $dbh->prepare("SELECT * FROM procure.RECPO")
or die "Couldn't prepare statment: " . $dbh->errstr;
## Get R-NAME from BUYER
my @data;
my $rv = $sth->execute
or die "Couldn't execute statement: " . $sth->errstr;
## Loop through each line of the PO
while (@data = $sth->fetchrow_array()) {
my $vCompany = $data[0];
my $vPO = $data[1];
my $vVendor = $data[2];
my $vBuyCode = $data[3];
print "\t$id: $vCompany $vPO $vVendor $vBuyCode\n";
## log into schema OCFT.lawson with userid RECLAW & password RECPASS
## read BUYER from lawson.buyer where BUYER-CODE equals $vBuyCode
## return R.NAME
## POLINESRC will return one record for each line of the PO
## now loop through each line of the PO and get each lawson.POLINESRC &
## lawson.REQUESTER record
## the key for POLINESRC is $vCompany & $vPO
## return requester & source_doc_n
## the key for REQUESTER is lawson.POLINESRC.requester
## return r-name & email_address
## load values from RECPO and all returned values into array
## no duplicates on requester & source_doc_n
}
I will work on the array after I get the inner loop working. The outter loop is working just fine.
I get this output:
Code:
$ perl reqNote_sh
Source record: 120 1608496 241350 LT
Source record: 120 1608495 391514 DT