Нет, это не сработает. Простой пример:
SQL> create table test as select * From dept;
Table created.
SQL> create or replace trigger trg_test
2 before update or delete on test
3 for each row
4 declare
5 l_cnt number;
6 begin
7 select count(*) into l_cnt
8 from emp where deptno = case when updating then :new.deptno
9 when deleting then :old.deptno
10 end;
11 end;
12 /
Warning: Trigger created with compilation errors.
SQL> show err
Errors for TRIGGER TRG_TEST:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/3 PL/SQL: SQL Statement ignored
5/46 PL/SQL: ORA-00920: invalid relational operator
SQL>
Ошибка здесь:
8 from emp where deptno = case when updating then :new.deptno
^^^^
Это означает, что вам придется сделать что-то вроде этого:
SQL> create or replace trigger trg_test
2 before update or delete on test
3 for each row
4 declare
5 l_deptno test.deptno%type;
6 l_cnt number;
7 begin
8 if updating then
9 l_deptno := :new.deptno;
10 elsif deleting then
11 l_deptno := :old.deptno;
12 end if;
13
14 select count(*) into l_cnt
15 from emp where deptno = l_deptno;
16 end;
17 /
Trigger created.
SQL>