18.9 About DML Locking

Use automatic Data Manipulation Language (DML) in Oracle Application Express to update or delete rows of a table.

18.9.1 About DML Locking

When you use automatic Data Manipulation Language (DML) in Oracle Application Express to update or delete rows of a table, a transaction is initiated to first lock the row, verify if it has changed since it was displayed on the page, and then finally issue the actual UPDATE or DELETE statement for the row.

In some environments where locking of rows is prevalent, you may want to control the DML operation and determine if the DML operation:

  • waits indefinitely

  • fails immediately

  • waits for a specified period of time

18.9.2 APEX_DML_LOCK_WAIT_TIME

You can set the value of an application substitution string, an application item, or a page item to APEX_DML_LOCK_WAIT_TIME to control the DML operation. APEX_DML_LOCK_WAIT_TIME supports the following values:

  • NULL (the default), results in the same behavior as previous versions of Oracle Application Express, that is, wait indefinitely.

  • 0 fails immediately if the row is locked by another database session.

  • > 0 and the row is locked, waits for the specified number of seconds.

When set in an application, the value for APEX_DML_LOCK_WAIT_TIME applies to all UPDATE and DELETE DML operations using Automatic DML in the entire application. To control a specific Automatic DML process, update the value of APEX_DML_LOCK_WAIT_TIME before the Automatic DML process and reset it after the Automatic DML process. Note that this does not affect updates and deletes using tabular forms.

18.9.3 FSP_DML_LOCK_ROW

You can also set the value of an application substitution string, an application item, or a page item to FSP_DML_LOCK_ROW to control the DML operation. FSP_DML_LOCK_ROW supports the following values:

  • If the value is set to FALSE, then no SELECT FOR UPDATE is issued.

  • If the value is anything other than FALSE, the default behavior of SELECT FOR UPDATE is performed when issuing an UPDATE or DELETE DML operation using Automatic DML.