Once upon a time when creating a lot of tables, types and triggers we ran into a weird “thingie” with Oracle JDeveloper PS6 where the WHEN statement of the trigger “disappered” in the code view.

The script (for one of our many, many, many triggers):

</pre>
--------------------------------------------------------
 -- DDL for Trigger ZMS_DMT_BRI
 --------------------------------------------------------

CREATE OR REPLACE TRIGGER "ZMS"."ZMS_DMT_BRI" BEFORE INSERT ON ZMS.ZMS_DOCUMENTEN
 REFERENCING OLD AS old NEW AS new
 FOR EACH ROW
 WHEN (new.ID IS NULL) BEGIN
 SELECT ZMS.ZMS_DMT_ID_SEQ.NEXTVAL
 INTO :new.ID
 FROM dual;
 END;
 /
 ALTER TRIGGER "ZMS"."ZMS_DMT_BRI" ENABLE;
<pre>

After compilation and testing our project we discovered the trigger was not working correctly. So we checked out our code and discovered this:

Result

The WHEN statements were suddenly gone from all our triggers. However when inspecting the triggers closely with the EDIT view we could see they were still there:

trigger2

However 1 trigger was (probably) accidentally recompiled from the source view, and JDeveloper then makes the WHEN statement disappear. By manually returning the WHEN clause (in EDIT view or in code and recompile)  the issue was fixed.

Still it’s “strange” in our opinion that the statement is not viewable from normal source code view of the artefact. We are not sure if this is a bug, a hidden feature, or we expecting something stupid 😉

Houd jij je kennis graag up to date?

Mis niets meer van onze kennisdocumenten, events, blogs en cases: ontvang als eerste het laatste nieuws in je inbox!

Fijn dat we je op de hoogte mogen houden!