Det virker kun, hvis EMP_ID
er ikke større end 0
. Er det? I mit tilfælde virker det :
Eksempeltabel:
SQL> CREATE TABLE employee
2 (
3 emp_id NUMBER
4 );
Table created.
Udløser:
SQL> CREATE OR REPLACE TRIGGER display_message
2 AFTER INSERT OR UPDATE
3 ON employee
4 FOR EACH ROW
5 WHEN (new.emp_id > 0)
6 BEGIN
7 DBMS_OUTPUT.put_line ('new employee details inserted');
8 END;
9 /
Trigger created.
Test:
SQL> SET SERVEROUTPUT ON;
SQL> INSERT INTO employee (emp_id)
2 VALUES (100);
new employee details inserted --> the message is here!
1 row created.
SQL>