Skip to content

A custom Event that sends an email when a row in FNDCN_APPLICATION_MESSAGE_TAB changes fails with ORA-04091 ('table... is mutating, trigger/function may not see it'). Since the mail-sending call effectively tries to touch the same table that's still mid-transaction, how do you send the email without hitting the mutating-table error?

Answer

Don't send the email directly from the event's own trigger context — defer it to a background job instead. Build a small PL/SQL block that sets up the mail attributes with Client_SYS.Add_To_Attr (FROM_USER_NAME_, TO_USER_NAME_, SUBJECT_, TEXT_, MAIL_SENDER_, etc.) and hands it off with Transaction_SYS.Deferred_Call('command_sys.mail', 'PARAMETER', attr_, 'job description') — running the actual mail send as a separate deferred background job breaks the direct trigger-time dependency on the still-mutating table, avoiding ORA-04091 entirely.

← Browse Workflows and automation questions