
How to Use Object Type Inheritance in Oracle
Create a subtype that inherits from a supertype, override its methods, and test and narrow values with IS OF and TREAT.
Posts tagged AI-Assisted are created with support from artificial intelligence. I use AI tools to research, draft, and refine ideas—combining human insight with machine precision to deliver clear, informed, and creative content.

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.

Handle any Oracle error by name with PRAGMA EXCEPTION_INIT, and give your own RAISE_APPLICATION_ERROR errors names that callers can catch.

Find out which error a PL/SQL handler caught with SQLCODE and SQLERRM, and target common errors with predefined exception names.

Unite, intersect, and subtract nested tables like sets, and test membership and subsets, in PL/SQL and SQL without loops.