-- CODE from SCRIPT 1
UPDATE SALES
SET EMP_MGR_TOTAL_CHNAGES = total
WHERE TRUNC(UPDATEDATE, 'MM/DD/YYYY') = TRUNC(sysdate, 'MM/DD/YYYY');
IF SQL%ROWCOUNT = 0 THEN -- no update
INSERT INTO SALES
(UPDATENUM,UPDATEDATE,EMP_MGR_TOTAL_CHANGES,EMP_TERM_TOTAL_CHNAGES)
VALUES
(SALES.UPDATENUMSEQ.NEXTVAL,SYSDATE,total,NULL);
END IF;
-- CODE from SCRIPT 2
UPDATE SALES
SET EMP_TERM_TOTAL_CHNAGES = total
WHERE TRUNC(UPDATEDATE, 'MM/DD/YYYY') = TRUNC(sysdate, 'MM/DD/YYYY');
IF SQL%ROWCOUNT = 0 THEN -- no update
INSERT INTO SALES
(UPDATENUM,UPDATEDATE,EMP_MGR_TOTAL_CHANGES,EMP_TERM_TOTAL_CHNAGES)
VALUES
(SALES.UPDATENUMSEQ.NEXTVAL,SYSDATE,NULL,total);
END IF;
|