i have a table 'Event' and it contains a trigger trEvent which updates table 'Position', and table 'Position' has a trigger trPosition which validates the Position records.
whenever trEvent is fired one record in Position table is updated and the trPosition trigger is fired to check the validation of position, if it is a valid position there is no problem but if the position is invalid how the trEvent should know there is something wrong with the Position which is updated.
in simple words how to access error message from trPosition trigger in trEvent trigger?
thanks in advance!
Best Answer
Based on the problem description, I tried to create a similar scenario including the solution. Hope this will help you.
Here I created tables and triggers.
Trigger trgEvents inserting the EventId into tbl_Position table if the EventId does not exists.
In the trigger trgPosition created on tbl_Position, I'm just validating whether column PositionId in tbl_Position is having a numeric value.
After I insert bellow execute the INSERT statement below.
It fails and complete transaction gets rolled back.
Thanks!