Работающий оракул с Perl
Раньше я выполнял обычные запросы с Perl-подобным (выберите, вставьте, обновите и удалите), пропустив точку с запятой в конце запроса, и он работает со мной, но в настоящее время мне приходится запускать оракул, но, как вы знаете, иногда продукт содержит N номер точки с запятой, есть идеи по этому поводу?
$dbh = DBI->connect($dsh,$login,$password,{ RaiseError => 1, AutoCommit => 0} ) or die "Database connection not made: $DBI::errstr";
unless($dbh){
warn "Unable to connect to Oracle ($DBI::errstr)\nTests skiped.\n";
print "1..0\n";
exit 0;}
$dbh->do("ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '.,'");
print localtime() ."............ Database connected sucessfully .............\n\n";
$sth2 = $dbh->prepare("
DECLARE
CURSOR coid_to_patch
IS
SELECT SIM.CO_ID,
PADV.SNCODE,
PADV.ADV_CHARGE,
SIM.BEFORE_TAX_AMT,
PADV.ADV_CHARGE_END_DATE,
PADV.ADV_CHARGE + SIM.BEFORE_TAX_AMT NEW_ADV_CHRG,
CA.CUSTOMER_ID,
NVL (CU.CUSTOMER_ID_HIGH, CA.CUSTOMER_ID) CALCULATED_CUSTID,
TMB1.TMCODE,
TMB1.VSCODE,
SIM.MARKET_CODE
FROM sysadm.SIMULATION_FROM_BSCS_EBLON SIM,
PROFILE_SERVICE_ADV_CHARGE PADV,
CUSTOMER_ALL CU,
CONTRACT_ALL CA,
MPULKTMB TMB1
WHERE SIM.CO_ID = PADV.CO_ID
AND SIM.CO_STATUS <> 'a'
AND PADV.ADV_CHARGE > 0
AND SIM.CO_ID = CA.CO_ID
AND CA.CUSTOMER_ID = CU.CUSTOMER_ID
AND CA.TMCODE = TMB1.TMCODE
AND TMB1.VSCODE = (SELECT MAX (VSCODE)
FROM MPULKTMB TMB2
WHERE TMB2.TMCODE = TMB1.TMCODE)
AND PADV.SNCODE = TMB1.SNCODE
AND TMB1.INTERVAL = 12
AND (PADV.ADV_CHARGE + SIM.BEFORE_TAX_AMT) >= 0
ORDER BY 6 ASC;
BEGIN
FOR cur IN coid_to_patch
LOOP
UPDATE PROFILE_SERVICE_ADV_CHARGE
SET ADV_CHARGE = CUR.NEW_ADV_CHRG,
ADV_CHARGE_ITEM_PRICE = CUR.NEW_ADV_CHRG
WHERE CO_ID = CUR.CO_ID AND SNCODE = CUR.SNCODE AND ADV_CHARGE > 0;
COMMIT;
dbms_output.put_line (
'Refund terminated for CoId: '
|| CUR.CO_ID
|| ' on Sncode : '
|| CUR.SNCODE);
END LOOP;
END;
")or die "Couldn't prepare statement: " . $dbh->errstr;
$sth2->execute() or die "SQL Error: $DBI::errstr\n";
$sth2->finish;
print localtime() ."..........Closed..........\n\n";
$dbh->commit;
$dbh->disconnect;
exit;