| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Simple Trigger Question
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;
![]() |
![]() |