--ABS-106973
-------CONTRACTCOMPONENTNONGRMCHARGES

CREATE OR REPLACE PROCEDURE INSERT_CONTRACTCOMPNONGRMCHARG AS
STMT VARCHAR2(5000);
BEGIN
  FOR X IN (SELECT CCGC.CONTRACT_ID, CCGC.CHARGERESIDUALVALUE, CCGC.CHARGELOSSCHARGE FROM CONTRACTCOMPONENTGRMCHARGES CCGC WHERE CCGC.CONTRACT_ID NOT IN (SELECT CCNGC.CONTRACT_ID FROM CONTRACTCOMPONENTNONGRMCHARGES CCNGC)) LOOP
    BEGIN
STMT := 'INSERT INTO CONTRACTCOMPONENTNONGRMCHARGES
(CONTRACT_ID,
CHARGERESIDUALVALUE,
CHARGELOSSCHARGE,
SYSTEMUSER_ID,
TIMESTAMP)
      SELECT '||X.CONTRACT_ID||','||''''||X.CHARGERESIDUALVALUE||''''||','||''''|| X.CHARGELOSSCHARGE||''''||', GETMINSYSTEMUSER(), SYSDATE FROM DUAL';
 EXECUTE IMMEDIATE(STMT);
COMMIT;
    EXCEPTION WHEN OTHERS  THEN NULL;
END;
    END LOOP;
END INSERT_CONTRACTCOMPNONGRMCHARG;
/
EXECUTE INSERT_CONTRACTCOMPNONGRMCHARG ;

DROP PROCEDURE  INSERT_CONTRACTCOMPNONGRMCHARG;