tags:

views:

55

answers:

2

Can we call a trigger function in a stored procedure.

+5  A: 

A trigger is automatically executed. So, dependant on what your Stored Procedure is doing, it will get called.

http://www.postgresql.org/docs/8.1/interactive/triggers.html

Ardman
Yes, but is there a way to explictly call a trigger function.
apn
As far as i know there isn't. Triggers are only automattically executed.
Rob
Can we supress the action that caused the trigger to fire when we met some criteria in the trigger.
apn
ex:In my stored procedure i have and insert statement on table xxxxx.I have trigger on xxxxxx table on before insert.In the trigger im checking if there exists a record with same id on the table,if i found any record i will update the table and should not allow to the insert to be executed.
apn
[Yes](http://www.postgresql.org/docs/current/static/plpgsql-trigger.html).
Milen A. Radev
Just return NULL to suppress.
rfusca
A: 

You might use a rule

pcent