티스토리 뷰

프로그래밍/DB

[PL/SQL] Database Trigger

DEV LION 2014. 1. 3. 09:34
CREATE TABLE dept 
   AS SELECT department_id,department_name, 0 TOT_DEPT_SAL  
FROM departments; 
SQL>ed trigger_test 
create or replace trigger dept_before 
  before insert on dept 
 begin 
  dbms_output.put_line('문장 before trigger가 발생했습니다.'); 
 end; 
/ 
create or replace trigger dept_after 
 after insert on dept 
 begin 
  dbms_output.put_line('문장 After trigger가 발생했습니다.'); 
 end; 
/ 
create or replace trigger dept_row_after 
 after insert on dept 
 for each row 
 begin 
  dbms_output.put_line('행 after trigger가 발행했습니다.'); 
 end; 
/ 
create or replace trigger dept_row_before 
 before insert on dept 
 for each row 
 begin 
  dbms_output.put_line('행 before trigger가 발생했습니다.'); 
 end; 
/
set serveroutput on 
insert into dept   
   SELECT department_id,department_name,0 FROM departments WHERE ROWNUM <=2;
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
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 31
글 보관함