
How to Lock Rows with SELECT FOR UPDATE in Oracle
Lock the rows you read until you update them with SELECT FOR UPDATE, and use NOWAIT, WAIT, and SKIP LOCKED to control waiting.

Lock the rows you read until you update them with SELECT FOR UPDATE, and use NOWAIT, WAIT, and SKIP LOCKED to control waiting.

Choose between READ COMMITTED, SERIALIZABLE, and READ ONLY transactions in Oracle, and know what each query sees and when ORA-08177 appears.

Reuse an expression across queries with a function marked SQL_MACRO(SCALAR), which Oracle expands into plain SQL when the query is parsed.

Create a subtype that inherits from a supertype, override its methods, and test and narrow values with IS OF and TREAT.

Replace slow row-by-row loops with FORALL, which sends one DML statement for a whole collection, and see how much faster it is.

See how concatenated input rewrites a query, stop it with bind variables, and validate table and column names with DBMS_ASSERT.

Make views over joins and aggregates updatable with INSTEAD OF triggers that turn DML on the view into the changes you choose on its tables.

Combine statement-level and row-level trigger logic in one compound trigger with shared variables, to read once, check each row, and report once.

Understand why a row trigger cannot query its own table, and fix ORA-04091 with a compound trigger that reads the data before the rows change.

Run trigger logic once per statement instead of once per row, to forbid operations such as deletes or to log batch changes.

Reset package variables with every database call using PRAGMA SERIALLY_REUSABLE, and see how it differs from normal session-long state.

Give package functions one name for different kinds of arguments with overloading, and avoid the ambiguous versions that cause PLS-00307.

Protect internal helper code by listing the only program units allowed to call it with ACCESSIBLE BY, checked when callers compile.

Decide whether a PL/SQL unit runs with its owner's or its caller's privileges with AUTHID, and when each choice is the right one.

Cut the cost of switching between SQL and PL/SQL for functions called from queries with PRAGMA UDF, and know the alternatives.

Speed up frequently called lookup functions by caching their results for all sessions with RESULT_CACHE, invalidated automatically.

Declare pure PL/SQL functions DETERMINISTIC so Oracle can skip repeated calls and allow them in function-based indexes and virtual columns.

Follow an exception through blocks and procedures until a handler catches it, avoid the declaration-error trap, and log and re-raise.