我正在使用 ORACLE 12c。
在一张桌子上,我有 2 个触发器,都是“更新前”。更新列时触发其中一个触发器,并且在此触发器中另一列获得新值。第二个触发器应该在更新第二列时触发。但他没有。
create table TRIGGER_TEST
(
col1 varchar2(64),
col2 varchar2(64),
col3 varchar2(64)
);
create or replace trigger TR_TRIGGER_TEST_1
before update of COL1 on TRIGGER_TEST
for each row
begin
dbms_output.put_line('here we are in TR_TRIGGER_TEST_1');
:new.col2 := 'only testing';
end;
/
create or replace trigger TR_TRIGGER_TEST_2
before update of COL2 on TRIGGER_TEST
for each row
begin
dbms_output.put_line('here we are in TR_TRIGGER_TEST_2');
:new.col3 := 'trigger_test_2 has fired';
end;
/
insert into TRIGGER_TEST values ('1_col1','1_col2','1_col3');
select * from TRIGGER_TEST;
COL1 …Run Code Online (Sandbox Code Playgroud)