Solved

How to format an Oracle null value Number?

Posted on 2008-10-02
5
1,175 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
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question About Creating Primary Key Constraints on Oracle Tables... 5 47
execute immediate plsql block 5 48
MULTIPLE DATE QUERY 15 79
Oracle Insert not working 10 28
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

832 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