Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Simple Trigger Question

Simple Trigger Question

From: Abey Joseph <abeyjoseph_at_hotmail.com>
Date: Fri, 3 Nov 2000 12:13:43 -0500
Message-ID: <hmCM5.45$H25.514@client>

Folks,

        I am trying to create a simple trigger (Oracle 7.3.4/AIX 4.3) on a table that should insert a few fields into a different table when a field in the main table is updated. The trigger compiles fine (I don't get an error message), but doesn't work. When I check the status it is enabled! Please see if someone can help me.

Here's the trigger...

CREATE OR REPLACE TRIGGER trigger_xyz
AFTER UPDATE OF column_date ON main_table FOR EACH ROW
DECLARE
    numrows NUMBER;
BEGIN
    IF :NEW.column_date IS NOT NULL
    THEN

        SELECT COUNT(*) INTO numrows
       FROM dest_table
       WHERE column_key = :NEW.column_key;

      IF (numrows > 0)
      THEN
          UPDATE dest_table
          SET column_date = SYSDATE,
          column_flag = 'N'
          WHERE  column_key = :NEW.column_key;
      ELSE
          INSERT INTO dest_table
          (column_key, column_date, column_flag)
          VALUES (:NEW.column_key, SYSDATE, 'N');
      END IF;

  END IF;
END; Received on Fri Nov 03 2000 - 11:13:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US