hi guys,
i hv a question, can we call a trigger in procedure, if so, one example please.
thanks
ram
Printable View
hi guys,
i hv a question, can we call a trigger in procedure, if so, one example please.
thanks
ram
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 kmesserQuote:
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.