Solved

How to format an Oracle null value Number?

Posted on 2008-10-02
5
1,185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 74

Accepted Solution

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

Assisted Solution

by:MikeOM_DBA
MikeOM_DBA earned 62 total points
ID: 22626580
Try:

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

Open in new window

0
 
LVL 3

Expert Comment

by:gajmp
ID: 22653154
SELECT TO_CHAR(NVL(TOTAL, 0),'0000000000.0000') FROM TEST_TAB
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

630 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