http://iotn.co.kr 연락처: gilho.kr@gmail.com [ The Japanese government should apologize to Japanese Military Sexual Slavery victim. / 日本政府は日本軍の性的奴隷?牲者に謝罪すべき. ]

사용자

ID:
PW:

INDEX
01.게시판
게시판 [68]
02.File Book
File 자료실 [95]
Site Link [16]
개인폴더 [195]
03.Field Book
Altibase [19]
Tibero [29]
MS-SQL [18]
MySQL [38]
DB2 [77]
ORACLE [2762]
PostgreSQL [88]
기타정보 [146]
운영체제 [563]
04.Q/A Book
Q/A [53]
05.방명록
방명록 [54]
레벨업 [37]
구인/구직 [1]

기념일
Search
LINK
+ 가족 Hompy
+ DNSEver
IOTN :: Field Book :: DB2

 회원가입

trigger test
최길호 [LIST]   2019-03-30 22:18:33, 조회 : 563

-- db2 9.7
create table trg_test ( id number,val number )
create table trg_log ( dt varchar2(10),dml varchar2(2),cnt number)

INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE,'YYYYMMDD'),'I',0)
INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE,'YYYYMMDD'),'D',0)
INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE,'YYYYMMDD'),'U',0)
INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE+1,'YYYYMMDD'),'I',0)
INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE+1,'YYYYMMDD'),'D',0)
INSERT INTO TRG_LOG VALUES (TO_CHAR(SYSDATE+1,'YYYYMMDD'),'U',0)
-- auto commit

CREATE OR REPLACE trigger trg_i
AFTER INSERT ON TRG_TEST FOR EACH ROW
UPDATE TRG_LOG SET CNT= CNT + 1 WHERE DT = TO_CHAR(SYSDATE,'YYYYMMDD') AND DML = 'I'

CREATE OR REPLACE trigger trg_u
AFTER UPDATE ON TRG_TEST FOR EACH ROW
UPDATE TRG_LOG SET CNT= CNT + 1 WHERE DT = TO_CHAR(SYSDATE,'YYYYMMDD') AND DML = 'U'

CREATE OR REPLACE trigger trg_d
AFTER DELETE ON TRG_TEST FOR EACH ROW
UPDATE TRG_LOG SET CNT= CNT + 1 WHERE DT = TO_CHAR(SYSDATE,'YYYYMMDD') AND DML = 'D'

insert into trg_test values ( 1,1001)
update trg_test set val = 1002
delete trg_test where id=1

select * from trg_test
select * from trg_log
update trg_log set cnt=0
3.236.13.53


  LIST

제목 작성자 작성일 조회
Troubleshoot  [jcc][t4][10205][11235][4.11.77] 널(NULL) password은(는) 지원되지 않습니다. ERRORCODE=-4461, SQLSTATE=42815    최길호 2020/10/24 283
Admin  DB2 상태 확인 status    최길호 2019/05/06 584
Admin  trigger test    최길호 2019/03/30 563
Admin  auto commit on/off    최길호 2019/03/30 767
Troubleshoot  DB21034E SQL0104N An unexpected token ";"/db2set DB2OPTIONS=-t/    최길호 2019/03/30 626
Admin  dba_objects dba_tables    최길호 2019/03/26 584
Troubleshoot  sql trace / db2 login fail log    최길호 2019/03/22 722
Troubleshoot  SQL0332N Character conversion from the source code page "970" to the target code page "819" is not supported.    최길호 2019/02/22 699
Admin  db2 list application [ db2 session 정보 확인 ]    최길호 2019/02/09 595
Backup&Recovery  test    최길호 2019/02/05 844
Troubleshoot  SQL6031N Error in the db2nodes.cfg file at line number "1". Reason code "10". [ hostname 변경 ]    최길호 2019/02/03 1061
Backup&Recovery  SQL1116N SQL2413N [ db2dart test /CHST /WHAT DBBP OFF ]    최길호 2014/04/22 3942
Troubleshoot  SQL0204N "DB2.TAB" is an undefined name. SQLSTATE=42704    최길호 2014/04/15 2750
Admin  db2 catalog tcpip node [ listener.ora, tnsnames.ora ]    최길호 2014/04/15 1927
Admin  test memo    최길호 2014/04/14 2232
Admin  db2 교육 자료     최길호 2014/04/07 1634
Backup&Recovery  db2relocatedb test    최길호 2013/06/11 2630

    목록보기   다음페이지 1 [2][3][4]
       

Copyright 1999-2021 Zeroboard / skin by 최길호(gilho.kr@gmail.com)
최근 댓글
최근 게시물
09/25
[ORACLE]
ORA-00600: internal error code....
by 최길호
09/24
[ORACLE]
ORA-24247: network access deni....
by 최길호
07/18
[게시판]
이재명을 지지합니다~ ☜(゚ヮ゚....
by 최길호