Table Locks for DML Operations

Data manipulation language (DML) operations include insertions, deletions, updates, and queries. For all such operations, table-level snapshot versioning permits one writer and multiple readers on any given table.

In table-level snapshot versioning:

The first transaction to open a table in write mode gains access to the table. A second transaction that tries to open the table in write mode receives an error. Any additional attempts to write to the table in the current transaction fail. The transaction can continue, but only with read operations or with writes to other tables.

SAP Sybase IQ supports share, write, and exclusive lock enqueuing, allowing you to lock a table for a specified period. You can write lock multiple tables simultaneously.

To avoid future version errors from subsequent DML statements, use the LOCK TABLE statement to reserve a write lock on the table or set of tables that you plan to modify.

In the case of deadlocks, the last LOCK TABLE statement that became blocked is usually rolled back and an error returns to that transaction about the form of deadlock that occurred.

In certain cases, you must issue COMMIT or ROLLBACK statements. For example, an explicit COMMIT or ROLLBACK is required to release locks when DML statements fail due to integrity constraints.

If a DML statement fails due to a referential integrity violation on the referenced table or an unavailable lock on other tables, you see: SQL Anywhere Error -210.