Solved

How to format an Oracle null value Number?

Posted on 2008-10-02
5
1,170 Views
Last Modified: 2013-12-19
Hi,

I have a number as TOTAL(15,4) Oracle.

If it is not null, it will print as:

00000000000.0000

If the TOTAL is null, I would like it to print like:

          0.0000

Leaving 10 empty spaces before the value 0.0000

How do I do that in pl/sql?


Thanks.
_Esam.
0
Comment
Question by:_Esam
5 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 63 total points
Comment Utility
NVL(total,lpad('0.0000',15))
0
 
LVL 29

Assisted Solution

by:MikeOM_DBA
MikeOM_DBA earned 62 total points
Comment Utility
Try:


Select TO_CHAR(NVL(Total,0),'99999999990.0000') From MyTable;

Open in new window

0
 
LVL 3

Expert Comment

by:gajmp
Comment Utility
SELECT TO_CHAR(NVL(TOTAL, 0),'0000000000.0000') FROM TEST_TAB
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now