Click to See Complete Forum and Search --> : performing commits within a trigger


colloboy
07-24-2002, 06:22 AM
Hi,

I have built a trigger which calls a procedure. This procedure in turn calls procedures within a package. The procedures within the package have commit statements within them.

When the trigger fires the following error occurs:

ORA-04092 cannot commit in a trigger

Is there any way around this? Alternatively, how else can you schedule things to run in Oracle when certain conditions are met that are not time related (i.e. a data change)?

Thanks for your help

schlaeger
07-24-2002, 06:51 AM
You can start an package functon
in an autonomous transaction

you find examples of autonomious
transactions on technet sample code

colloboy
07-24-2002, 07:41 AM
Thanks a lot schlaeger, using 'pragma autonomous_transaction' worked.

Dosth
07-26-2002, 09:30 AM
coolbuy,
just curious , I know you may have considered this and it might be your requirement, but are u sure you want to use autonomous transaction in your case. you have to handle undoing what the procedure did when the transaction fails.

Cheers