Oracle SQL and PL/SQL guides

Practical answers for Oracle developers: tuning slow queries, reading execution plans, debugging PL/SQL, finding locks, moving data and testing code.

Why is my Oracle query slow? Seven common causes

The most common reasons an Oracle SQL query is slow: functions on indexed columns, implicit conversions, leading wildcards, NOT IN, OR conditions, stale statistics. With fixes.

How to read an Oracle execution plan

Get an Oracle execution plan with EXPLAIN PLAN and DBMS_XPLAN, read it in the right order, and understand full scans, index range scans, nested loops and hash joins.

How to debug a PL/SQL procedure

Debug an Oracle PL/SQL procedure: the privileges you need, compiling with debug information, breakpoints, stepping and watching variables, and DBMS_OUTPUT as a fallback.

How to find text in Oracle PL/SQL source code

Find every package, procedure, function and trigger that uses a table, column or text, with ALL_SOURCE, and what it does not cover (views).

How to find blocking sessions in Oracle

Find which Oracle session blocks others, what it is running and which table is locked, with V$SESSION and V$LOCKED_OBJECT, on single instance and RAC.

How to export an Oracle query to Excel or CSV

Export Oracle query results to CSV with SQL*Plus or SQLcl, open them in Excel without losing leading zeros or dates, or export straight to an Excel workbook.

How to import a CSV file into an Oracle table

Load a CSV file into an Oracle table with SQL*Loader or an external table, with the control file and table definitions, or with an import wizard.

How to compare two Oracle schemas

Compare two Oracle schemas with data dictionary queries: missing objects, column differences and code, and get the DDL with DBMS_METADATA.

How to format PL/SQL code

A practical formatting style for Oracle SQL and PL/SQL: keyword case, indentation, one column per line, aligned parameters and naming prefixes, with examples.

How to unit test PL/SQL with utPLSQL

Write and run PL/SQL unit tests with utPLSQL v3: a test package with --%suite and --%test annotations, expectations, and running the tests.

Try it on your own database

Felix is a Windows IDE for Oracle SQL and PL/SQL, from 11g to 23ai. Every feature is in the free 30-day trial; no account needed.