Advertisements
RSS

JDeveloper and the lost trigger when clause

24 Jun

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 ;-)

Advertisements
 
Leave a comment

Posted by on 24-06-2013 in JDeverloper, Oracle

 

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: