Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1989

How to Tune SQL Statement with DECODE Expression for Oracle?

$
0
0
Here the following is an example SQL statement with a DECODE expression syntax.

select * from employee
where decode(emp_dept, 'AAA', 'ADM','AAB','ACC',emp_dept)='ADM'

Here the following are the query plans of this SQL, it takes 6.41 seconds to finish. The query shows a Full Table Scan of EMPLOYEE table due to the DECODE expression cannot utilize the EMP_DEPT column’s index.
[​IMG]
We can rewrite the DECODE expression...

How to Tune SQL Statement with DECODE Expression for Oracle?

Viewing all articles
Browse latest Browse all 1989

Trending Articles