C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






NVL in Oracle Query


Posted Date: 12 Sep 2008    Resource Type: Code Snippets    Category: SQL

Posted By: Prafulla S Shimpi       Member Level: Gold
Rating:     Points: 10



Please check NVL statement used in Oracle Queries.
It makes major impact while query processing based on indexes

Example

In Customer table, structutre may be as below:


Custid - Number - Not Null
Salute - varchar2(5) - Not Null
Title - varchar2(5) - Not Null
FName - varchar2(5) - Not Null
MName - varchar2(5) - Null
LName - varchar2(5) - Not Null
Address - varchar2(5) - Null
City - varchar2(5) - Not Null
Pin - varchar2(5) - Not Null
UseOrNot - varchar2(5) - Null (Y/N)

If this contains numerous data, and if you are using statment like this:

select * from customer
where NVL(UseOrNo,'N') = 'Y'
[/cde]
It uses indexes on table which cause major cost and it may result in performance issue.

This statement can be re-written without using NVL like this:


select * from customer
where UseOrNo = 'Y'


The NVL prevents the use of the index on the Customer table and reduces cost of searching to negligible amount of time.


Attachments

  • Oracle NVL ()



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Oracle NVL  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: To find the second highest record from database
    Previous Resource: Column Default Values
    Return to Discussion Resource Index
    Post New Resource
    Category: SQL


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    conference call

    Contact Us    Privacy Policy    Terms Of Use