codepoetly
codepoetly

Reputation: 17

Trigger not firing on operation

Created a trigger on a table which compiled and message "Trigger Created" was displayed.

But on operation on the particular table, the trigger does not fire.

What could be the issue or is there a catch here?

Upvotes: 1

Views: 3197

Answers (2)

Rogue Coder
Rogue Coder

Reputation: 505

If you are using oracle, you can try enabling the trigger

    ALTER TABLE tblName ENABLE TRIGGER trgName --WRONG

Correcting the syntax(thanks for the comment) :

    ALTER TRIGGER trg_name ENABLE;

To check if your trigger exists, valid/invalid, etc.:

    SELECT * from dba_triggers WHERE LOWER(trigger_name) LIKE '%salupdate%';
    SELECT * FROM dba_objects WHERE LOWER(object_name) LIKE '%salupdate%';

The user is using DBMS_OUTPUT.PUT_LINE in trigger which is not seen in output, following solves the issue:

    SET SERVEROUTPUT ON;

Upvotes: 0

amirdavod
amirdavod

Reputation: 95

Check if the trigger is valid and enabled:

SELECT * FROM User_Objects t WHERE t.OBJECT_TYPE = 'TRIGGER';
SELECT t.* FROM User_Triggers  t;

Upvotes: 1

Related Questions