CREATE OR REPLACE TRIGGER SELFDIAG_STAT_TRIGGER
AFTER UPDATE OR INSERT ON C_STAT
FOR EACH ROW
DECLARE
BEGIN
IF INSERTING THEN
DBMS_OUTPUT.PUT_LINE('INSERT');
IF :new.scont_cd = '1' THEN
DBMS_OUTPUT.PUT_LINE('SCONT_CD YES 1');
INSERT INTO SELFDIAG_STAT_BK
VALUES(
TO_CHAR(SYSDATE,'YYYY'),
:new.sid ,
:new.sname,
:new.sno,
:new.sono,
(SELECT oname FROM c_office WHERE ono = :new.sono),
:new.suid,
:new.suname,
'N',
:new.scodi_uid,
sysdate,
:new.ip,
'N'
);
END IF;
ELSIF UPDATING THEN
DBMS_OUTPUT.PUT_LINE('UPDATE');
IF :new.scont_cd != '1' THEN
DBMS_OUTPUT.PUT_LINE('SCONT_CD NO 1');
UPDATE SELFDIAG_STAT_BK
SET DEL_YN = 'Y', MNG_DATE = sysdate
WHERE YEAR = TO_CHAR(SYSDATE,'YYYY') AND SID = :new.sid;
END IF;
END IF;
exception
when others then
DBMS_OUTPUT.PUT_LINE('trigger error');
END;
/
결과는 정상적으로 되는데요
마지막에 trigger error가 한번뜨는데 왜 그런지 이유를 모르겠네요;;