View PL/SQL Execution Plan Guide

In PL/SQL, you can use the following methods to view the execution plan:

  1. Using the DBMS_XPLAN package: this is a package provided by Oracle that can be used to display the execution plan of SQL statements. Firstly, enable the automatic tracing feature by setting SET AUTOTRACE ON, then execute the SQL statements in a PL/SQL program, and finally use SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY()) to display the execution plan.
  2. When using SQL Developer: If you are using Oracle SQL Developer as your development tool, you can select the “Execute Plan” button on the toolbar, or use the Ctrl+E shortcut to display the execution plan of your SQL statement.
  3. When using SQLPlus, you can use the EXPLAIN PLAN statement to generate an execution plan and view the plan by using SELECT * FROM PLAN_TABLE.

Regardless of the method you use, make sure to set SET AUTOTRACE ON before running a query or use the EXPLAIN PLAN FOR statement to enable tracking of the execution plan.

bannerAds