Create a Before Statement trigger : Before Trigger « Trigger « Oracle PL / SQL






Create a Before Statement trigger

 
SQL> CREATE TABLE DEPT(
  2      DEPTNO NUMBER(2),
  3      DNAME VARCHAR2(14),
  4      LOC VARCHAR2(13)
  5  );

Table created.

SQL>
SQL> INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');

1 row created.

SQL> INSERT INTO DEPT VALUES (20, 'RESEARCH', 'DALLAS');

1 row created.

SQL> INSERT INTO DEPT VALUES (30, 'SALES', 'CHICAGO');

1 row created.

SQL> INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');

1 row created.

SQL>
SQL> 
SQL> create or replace trigger deptbs before insert or update or delete
  2     on dept
  3     begin
  4        dbms_output.put_line('before statement (dept)');
  5     end;
  6  /

Trigger created.

SQL>
SQL> drop table dept;

Table dropped.

   
  








Related examples in the same category

1.Define trigger brefore all updataction actions
2.Create a Before Row Trigger