Home > Oracle > Explain Plan for Sql

Explain Plan for Sql


variable b1 char(2);
variable b2 number;
variable b3 number;
variable b4 number;
variable b5 char(2);
variable b6 number;

begin
:b1 := 'SX'; 
:b2 := 0;
:b3 := 173593;
:b4 := 8;
:b5 := 'AB';
:b6 := 2009;
end;
/

explain plan for
SELECT   cmpy, PATH, sysref, tran_date, bal, btch_num, btch_seq_num, yy, per,
         fncl_val, recon
    FROM tedtran
   WHERE (   (   (    ((cmpy = :b1 AND PATH = :b2) AND sysref = :b3)
                  AND ((per = :b4 AND bal = :b5) AND yy = :b6)
                 )
              OR (    ((cmpy = :b1 AND PATH = :b2) AND sysref = :b3)
                  AND ((per = :b4 AND bal = :b5) AND yy = :b6)
                 )
             )
          OR (    ((cmpy = :b1 AND PATH = :b2) AND sysref = :b3)
              AND ((per = :b4 AND bal = :b5) AND yy = :b6)
             )
         )
ORDER BY cmpy ASC,
         PATH ASC,
         sysref ASC,
         tran_date ASC,
         bal ASC,
         btch_num ASC,
         btch_seq_num ASC;
select * from table (dbms_xplan.display());

Advertisements
Categories: Oracle
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: