1

I used to run normal queries with Perl like (select & insert & update & delete ) with skipping insert semicolon at the end of the query and its working with me, but currently I have to run oracle prouder but as you know the producre sometimes contains N number of the semicolon, any idea about this ?

$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;
1
  • 1
    I believe this is a possible duplicate. Take a look at this question. Commented Aug 6, 2019 at 22:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.