Question

Event Action

  • 18 January 2023
  • 3 replies
  • 69 views

Userlevel 1
Badge +5

Hi,

When I add a new record to the shipment table, I want the following event to run, but it throws an error.

I try this too - >

Declare

Begin

UPDATE SHIPMENT_TAB SET AUTO_CONNECT_BLOCKED='TRUE' where SHIPMENT_ID=&NEW:SHIPMENT_ID;

End;

 

please your support :)

 

 


3 replies

Userlevel 7
Badge +18

Please mention what is the error you received?

Userlevel 1
Badge +5

 

 

Userlevel 7
Badge +19

Problem is that you use the pragma to create a separate session. The shipment is only created in your session and since it is not yet committed it is not seen by the other session you start in the event.

You are creating a new session to avoid the mutating table error since you want to update the same table the event is triggering on.

It is impossible to do this directly in the event. It is only possible if you instead post a background job in the event that then executes after your session is ready.

Read more here: 

 

I’m not sure if that solves the issue for your business needs but it might.

Reply