I have clients-->|cascade rule|-->orders_table-->|cascade rule|-->order_details in my order_details I have after delete trigger that increment the quantity in my product table
CREATE OR ALTER TRIGGER TABLEAU_DETAIL_VENTES_AD0 FOR TABLEAU_DETAIL_VENTES ACTIVE AFTER DELETE POSITION 0 AS declare variable qte numeric_15_2; begin select qte_article from tableau_articles where id_article = old.id_article into :qte; qte = :qte + old.qte; update tableau_articles set qte_article = :qte where id_article = old.id_article; end
If I delete a client than all orders depending on it will be deleted and the orders_detail so on.
The problem is that order_details after delete trigger will be fired and incrementing the product quantity I don't want that to happen.
My question: is there any way to know if the trigger has been fired by cascade rule or sql delete statement that come from the application?
I want to achieve something like:
If trigger triggered by the cascade rule then disable_all_triggers. Thanks in advance for your help.