trigger in procedure
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: trigger in procedure

  1. #1
    Join Date
    Apr 2001
    Posts
    5

    Question

    hi guys,

    i hv a question, can we call a trigger in procedure, if so, one example please.

    thanks
    ram

  2. #2
    Join Date
    Aug 2000
    Posts
    462
    triggers aren't called. They execute automatically in response to database events.

    Have you considered having your trigger call a procedure that does the functionality, and then calling that procedure from your other locations also?

    such as;

    create or replace procedure myproc as
    begin
    insert into mytable2 values('X');
    end;
    /

    create or replace trigger mytrigger before insert on mytable1 for each row
    begin
    myproc;
    end;
    /


    Then the procedure fires every time the trigger fires, and if you want to call it otherwise, you can just execute it directly.

  3. #3
    Join Date
    Apr 2001
    Posts
    5

    Thumbs up

    Originally posted by kmesser
    triggers aren't called. They execute automatically in response to database events.

    Have you considered having your trigger call a procedure that does the functionality, and then calling that procedure from your other locations also?

    such as;

    create or replace procedure myproc as
    begin
    insert into mytable2 values('X');
    end;
    /

    create or replace trigger mytrigger before insert on mytable1 for each row
    begin
    myproc;
    end;
    /


    Then the procedure fires every time the trigger fires, and if you want to call it otherwise, you can just execute it directly.
    thanks kmesser

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width