Second Before Trigger Does Not See Value Of CLOB Modified In First Before Trigger (Doc ID 1322350.1)

Last updated on MARCH 23, 2015

Applies to:

Oracle Database - Enterprise Edition - Version 10.1.0.3 to 11.1.0.7 [Release 10.1 to 11.1]
Information in this document applies to any platform.

Symptoms

If there are 2 before triggers, the second trigger wipes out any lob outbind set by the first trigger.
After trigger 1 modifies the value of a lob column, this lob is passed into trigger 2.
On exit from trigger 2 the original value for the lob column is then passed into the insert (or update), not the value modified by trigger 1.

Example

set echo on;
set serveroutput on;
drop table tab1;
create table tab1 (c2 CLOB);

create or replace trigger tab1_trg1 before insert or update on tab1
referencing old as old new as new
for each row
begin
:new.c2 := 'def';
end;
/

create or replace trigger tab1_trg2 before insert or update on tab1
referencing old as old new as new
for each row follows tab1_trg1
begin
dbms_output.put_line(:new.c2);
end;
/

commit;

insert into tab1 values ('abc');


select * from tab1;

C2
--------------------------------
abc


REM  The second trigger tab1_trg2 does not change the value
REM  So c2 should have value 'def', instead is has value 'abc'
REM  If we drop trigger tab1_trg2 it works correctly.
REM  If we do not read :new.c2 in tab1_trg2, it works correctly.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms