My code is set to automatically switch between product lines (production and test) for the regular code, but it fails to switch in the DBI command.
Here is the basic code.
#!/usr/lpp/oracle/product/10.2/perl/bin/perl
#### program variables
if($PRODLINE eq "ocfp") {
$sys = "ocfp";
$dbsys = "lawocfp";
}
else {
$sys = "ocft";
$dbsys = "lawocft";
}
$LAWDIR="/usr/lawson/lawson/";
$vPath1=$LAWDIR . $sys . "/edi/in/810/";
$vName1="GHX810.out";
$vFlag = "";
... code...
## save the line record
use DBI;
$dbh = DBI->connect('DBI:Oracle:host=$dbsys;
sid=$dbsys', 'procure', 'procure90') or
die "$DBI::errstr";
$query = "INSERT INTO omflaw.X12LINE(company, invoice,
invoice_dte, po_number, line_nbr, item, ven_item,
description, qty, uom, price) VALUES
('"."$company"."',
'"."$invoice"."',
'"."$invoice_dte"."',
'"."$po_number"."',
$line_nbr,
'"."$item"."',
'"."$ven_item"."',
'"."$description"."',
'"."$qty"."',
'"."$uom"."',
'"."$price"."')";
$dbh->do($query) or die "$DBI::errstr";
$dbh->disconnect();
}
The error I get is
$ ./ghxEDMP
DBI connect('host=$dbsys;
sid=$dbsys','procure',...) failed: ORA-1
2545: Connect failed because target host or object does not exist (DBD ERROR: OC
IServerAttach) at ghxEDM_pl line 153
ORA-12545: Connect failed because target host or object does not exist (DBD ERRO
R: OCIServerAttach) at ghxEDM_pl line 153, <X12> line 1.
The issue is that the variable $dbsys did not convert to it's value.
Is there a way to use a variable in the DBI statement?
Here is the basic code.
#!/usr/lpp/oracle/product/10.2/perl/bin/perl
#### program variables
if($PRODLINE eq "ocfp") {
$sys = "ocfp";
$dbsys = "lawocfp";
}
else {
$sys = "ocft";
$dbsys = "lawocft";
}
$LAWDIR="/usr/lawson/lawson/";
$vPath1=$LAWDIR . $sys . "/edi/in/810/";
$vName1="GHX810.out";
$vFlag = "";
... code...
## save the line record
use DBI;
$dbh = DBI->connect('DBI:Oracle:host=$dbsys;
sid=$dbsys', 'procure', 'procure90') or
die "$DBI::errstr";
$query = "INSERT INTO omflaw.X12LINE(company, invoice,
invoice_dte, po_number, line_nbr, item, ven_item,
description, qty, uom, price) VALUES
('"."$company"."',
'"."$invoice"."',
'"."$invoice_dte"."',
'"."$po_number"."',
$line_nbr,
'"."$item"."',
'"."$ven_item"."',
'"."$description"."',
'"."$qty"."',
'"."$uom"."',
'"."$price"."')";
$dbh->do($query) or die "$DBI::errstr";
$dbh->disconnect();
}
The error I get is
$ ./ghxEDMP
DBI connect('host=$dbsys;
sid=$dbsys','procure',...) failed: ORA-1
2545: Connect failed because target host or object does not exist (DBD ERROR: OC
IServerAttach) at ghxEDM_pl line 153
ORA-12545: Connect failed because target host or object does not exist (DBD ERRO
R: OCIServerAttach) at ghxEDM_pl line 153, <X12> line 1.
The issue is that the variable $dbsys did not convert to it's value.
Is there a way to use a variable in the DBI statement?