Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

Linda Webb

Got breaking Oracle news?    Burleson Consulting Oracle News

Click here for more Oracle News Headlines

 


Oracle CASE vs. DECODE machinations explained

Doug Burns has published one of the most comprehensive papers ever on the Oracle CASE statement and how it differs from DECODE:

http://oracledoug.blogspot.com/2005/10/case-article.html

Burns also has a good whitepaper explaining the details of the DECODE statement, where he observes several shortcomings on DECODE:

http://doug.burns.tripod.com/decode.html

“The first is that of code readability. It should be clear from Example 7 that clean and readable code formatting is essential when using a number of DECODEs, particularly if they are nested.

The second, which was mentioned earlier, is that DECODE is a post-retrieval function and it is easy to write code which is spectacularly inefficient but functionally correct. As a first principle for any SQL statement you may write, you should attempt to reduce the rows retrieved using the best access path and the most selective WHERE clause. Only then should you use DECODE for additional processing.

The final potential problem with DECODE is that it is an Oracle-specific extension and is not included in the ANSI standards. This is a problem if code-portability to other databases is an issue, but shouldn't distract you from the extra power in the Oracle implementation. Many of us use PL/SQL, after all!”

In the Oracle CASE expression paper, Burns notes that CASE was designed as a replacement for DECODE:

http://doug.burns.tripod.com/case.doc

"CASE was introduced in Oracle 8.1.6, however, and is a much better option because it is

1)         More flexible than DECODE

2)         Easier to read

3)         ANSI-compatible (if that matters to you)

However, CASE is essentially a better implementation of DECODE so the reasons for using either are similar."

Burns concludes about the CASE statement and offers some tips for using CASE expressions:

“CASE is a post-retrieval function and it is easy to write code which is spectacularly inefficient but functionally correct. Remember the golden rule :

Use the WHERE clause to eliminate all unnecessary data first and then use CASE for additional processing.”


 

 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational