Monday, June 25, 2007

Adding a missing tab to SQL Developer

In SQL Developer v1.2 the trigger tab for views is missing. You can add this tab (and many many others you can think of) by using User Defined Extensions.

Create an XML file with the definition of the tab:

<?xml version="1.0" encoding="UTF-8"?>
<items>
  <item type="editor" node="ViewNode" vertical="true">
    <title><![CDATA[Triggers]]></title>
    <query>
      <sql>
        <![CDATA[select table_owner
                , trigger_name
                , trigger_type
                , triggering_event
                , status
                from user_triggers
                where table_name = :OBJECT_NAME
        ]]>
      </sql>
    </query>
    <subquery type="code">
      <query>         <sql><![CDATA[ select dbms_metadata.get_dll
                                ('TRIGGER'
                                ,:trigger_name
                                ,:object_owner
                                ) SQL
                       from dual
                ]]>
        </sql>
      </query>
    </subquery>
  </item>
</items>
Save this file and add it as an User Defined Extension of type "Editor" (using Tools / Preferences / Database / User Defined Extensions), restart SQL Developer and voilá: the trigger tab is back...
Post a Comment