Handling Null Values in Oracle

Oftentimes, a query will return null values for some of the columns in a query. However, to display “null” as the value in the generated report isn’t a very effective way to display this information. Oracle provides an easy solution for this problem.

For example, suppose you are generating a report for a supplier. The table schema may look like this:

Table: SuppDetailsSUPPID	SUPPNAME SUPPADDRESS------	-------- -----------1	ABC1	#1, St. Thomas St..2	ABC2	New Brigade, Raj St..3	ABC3

In this situation, your query is also fetching SuppAddress, the value for the SuppAddress where SuppID = 3 is null:


To avoid displaying null, try using this query:


This returns the SUPPNAME if the SUPPADDRESS is null.

Here’s another example: suppose you’ve got a table with a COMMISSION column in it and there’s a possibility that the column is null. Instead of using this:

Select COMMISSION from TABLE_COMM would return null;

Try this:

Select NVL(COMMISSION,0) from TABLE_COMM would return 0(Zero). 

Using NVL in your queries where you expect null to be returned will also help avoid processing on the front-end code as well.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS