Quantcast
Channel: Oracle Maniacs' Notes » Admin
Viewing all articles
Browse latest Browse all 25

How to get explain plan from the database

$
0
0

We would like to get explain plan for a SQL statement. The SQL statement is,

Select * from gl_interface

Execute the following code to generate the explain plan

EXPLAIN PLAN
SET
STATEMENT_ID = 'ray'
FOR
SELECT * FROM gl_interface;

After executing the previous statement you need to extract the explain plan from the database. Execute the following,

SELECT *
  FROM TABLE (DBMS_XPLAN.display ('plan_table', 'ray'));

On executing this SQL you will get,

You can now see the explain plan in the output of the query.

Cheers!



Viewing all articles
Browse latest Browse all 25

Trending Articles