일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- GIT
- Source
- IntelliJ
- 네트워크
- 줄바꿈 문자
- Mac
- netsh
- web.xml
- Windows
- Quartz
- context
- 단축키
- bash
- ssh
- Eclipse
- tomcat
- vscode
- lsof
- VirtualBox
- profile
- grep
- import
- xargs
- plugin
- maVen
- JavaScript
- port
- find
- Windows 10
- resource
- Today
- Total
develog
trigger 본문
CREATE OR REPLACE TRIGGER ATEST_TRIGGER
BEFORE INSERT OR UPDATE OR DELETE ON ATEST
REFERENCING OLD AS O NEW AS N
FOR EACH ROW
DECLARE
BEGIN
IF INSERTING THEN
INSERT INTO ATEST_LOG
(SEQ, TITLE, NOTE, USE_YN, REG_TS, MOD_TS, LOG_TS, LOG_TYPE)
VALUES
(:O.SEQ, :O.TITLE, :O.NOTE, :O.USE_YN, :O.REG_TS, :O.MOD_TS, SYSTIMESTAMP, 'I');
END IF;
IF UPDATING THEN
INSERT INTO ATEST_LOG
(SEQ, TITLE, NOTE, USE_YN, REG_TS, MOD_TS, LOG_TS, LOG_TYPE)
VALUES
(:O.SEQ, :O.TITLE, :O.NOTE, :O.USE_YN, :O.REG_TS, :O.MOD_TS, SYSTIMESTAMP, 'U');
END IF;
IF DELETING THEN
INSERT INTO ATEST_LOG
(SEQ, TITLE, NOTE, USE_YN, REG_TS, MOD_TS, LOG_TS, LOG_TYPE)
VALUES
(:O.SEQ, :O.TITLE, :O.NOTE, :O.USE_YN, :O.REG_TS, :O.MOD_TS, SYSTIMESTAMP, 'D');
END IF;
END;
--트리거 삭제
DROP TRIGGER ATEST_TRIGGER;
'DB > Oracle' 카테고리의 다른 글
Function (0) | 2013.02.12 |
---|---|
[Oracle] CREATE INDEX (0) | 2013.02.08 |
WMSYS.WM_CONCAT (0) | 2013.01.10 |
plsql default parameter (0) | 2012.12.13 |
Pseudo Columns (0) | 2012.12.12 |