CREATE TABLE emp7 ( eid VARCHAR2(20) , auth VARCHAR2(20) , acu_auth VARCHAR2(99) , CONSTRAINT pk_emp7 PRIMARY KEY(eid) ) ; CREATE OR REPLACE TRIGGER tri_emp7 BEFORE INSERT OR UPDATE OF auth ON emp7 FOR EACH ROW DECLARE v_gb VARCHAR2(1) := SUBSTR(:NEW.AUTH, -1); v_v VARCHAR2(20) := SUBSTR(:NEW.AUTH, 1, LENGTH(:NEW.AUTH)-2); BEGIN IF v_gb = 'A' THEN :NEW.acu_auth := :NEW.acu_auth ||'|'|| v_v; ELSIF v_gb = 'D' THEN :NEW.acu_auth := REPLACE(:NEW.acu_auth, v_v); :NEW.acu_auth := LTRIM(RTRIM(REPLACE(:NEW.acu_auth, '||', '|'), '|'), '|'); END IF; END; / INSERT INTO emp7(eid, auth) VALUES('admin', 'DAEJEON,1,A'); SELECT * FROM emp7 WHERE eid = 'admin'; UPDATE emp7 SET auth = 'SEOUL,3,A' WHERE eid = 'admin'; UPDATE emp7 SET auth = 'BUSAN,3,A' WHERE eid = 'admin'; UPDATE emp7 SET auth = 'BUSAN,3,D' WHERE eid = 'admin';