Database Articles

  Home arrow Database Articles arrow Using and Modifying Oracle Triggers
DATABASE ARTICLES

Using and Modifying Oracle Triggers
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2011-04-06

    Table of Contents:
  • Using and Modifying Oracle Triggers
  • Leveraging Triggers in PHP Applications

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Using and Modifying Oracle Triggers


    (Page 1 of 2 )

    In this conclusion to a three-part series, you'll learn how to view existing Oracle triggers, modify them, and use them in your PHP applications. This article is excerpted from chapter 37 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).

    Viewing Existing Triggers

    Using the Oracle Database XE GUI, it’s easy to view existing triggers. From the Object Browser page, select Triggers. In the scroll box on the left, select the trigger to view. In Figure 37-6, the trigger AU_TECHNICIAN_T1is selected and you can see the details of the trigger itself.


    Figure 37-6.  Trigger details

    Clicking the SQL tab above the trigger details shows you the SQL used to create the trigger:

    CREATE OR REPLACE TRIGGER "AU_TECHNICIAN_T1" AFTER
    update on "TECHNICIAN"
    for each row
     WHEN (NEW.AVAILABLE = 0) begin
    UPDATE TICKET
      
    SET TECHNICIAN_ID = 0
    WHERE TECHNICIAN_ID = :NEW.TECHNICIAN_ID; end;
    /
    ALTER TRIGGER "AU_TECHNICIAN_T1" ENABLE
    /

    Modifying or Deleting a Trigger

    There is no functionality for modifying an existing trigger using the Oracle Database XE GUI. Therefore, you must copy the attributes of the existing trigger, drop it using the Drop button shown in Figure 37-6, and recreate it using the steps outlined previously.

    If you do not have the Oracle Database XE GUI available, you can drop the trigger using the SQL Commands interface or another SQL command-line interface using theDROP TRIGGERcommand as follows:

    DROP TRIGGER AU_TECHNICIAN_T1;


    Caution  When you drop a table, all triggers defined against the table are also deleted.


    More Database Articles Articles
    More By Apress Publishing

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap