Reputation: 519
For a school assignment I need to simulate a deadlock in the UI of my APEX application. I know how a deadlock works and why it occurs, but I cannot figure out how someone would simulate a deadlock in an APEX application.
Keep in mind, I don't mean the SQL editor in APEX, but the actual app builder.
When would one start a transaction and how would it occur that a started transaction would run long enough for another transaction to cause a deadlock.
Hope someone could help me because I really do not know how I would simulate such a case.
Thanks.
Upvotes: 1
Views: 345
Reputation: 11591
Setup:
create table T as select 0 x from dual union select 1 x from dual;
Then on a button press, have the following PLSQL code:
delete from t where x = :item;
dbms_session.sleep(30);
delete from t where x = (1-:item);
Then fire up two APEX sessions:
Upvotes: 2