469,324 Members | 1,414 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,324 developers. It's quick & easy.

Number Formatting

Stang02GT
1,208 Expert 1GB
I am trying to get negative numbers to display as (1,23)

the current format is as follows...

Expand|Select|Wrap|Line Numbers
  1. '9G990D00', 'NLS_NUMERIC_CHARACTERS = '',.'' 
If I edit 9G990D00 to (9G990D00) would that do it?
Jun 3 '08 #1
6 1992
r035198x
13,262 8TB
I am trying to get negative numbers to display as (1,23)

the current format is as follows...

Expand|Select|Wrap|Line Numbers
  1. '9G990D00', 'NLS_NUMERIC_CHARACTERS = '',.'' 
If I edit 9G990D00 to (9G990D00) would that do it?
The dirty thoughts going in my head right now yield
Expand|Select|Wrap|Line Numbers
  1. select replace (replace (to_char('-5000.8','9999.99PR'), '<', '('), '>', ')') from dual
Jun 3 '08 #2
Stang02GT
1,208 Expert 1GB
The dirty thoughts going in my head right now yield
Expand|Select|Wrap|Line Numbers
  1. select replace (replace (to_char('-5000.8','9999.99PR'), '<', '('), '>', ')') from dual

That worked nicely. Thanks very much! :)
Jun 3 '08 #3
amitpatel66
2,367 Expert 2GB
Try this as well:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT '('||TO_CHAR(-5000.8 * -1,'9999.99')||')' FROM dual
  3.  
  4.  
Jun 5 '08 #4
r035198x
13,262 8TB
Try this as well:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT '('||TO_CHAR(-5000.8 * -1,'9999.99')||')' FROM dual
  3.  
  4.  
That would work only for negative numbers?
Jun 5 '08 #5
amitpatel66
2,367 Expert 2GB
That would work only for negative numbers?
Yap. the OP wanted to display the negative numbers in that particular format.
Btw, the best way would be:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT '('||TO_CHAR(ABS(-5800.0),'9999.99')||')' from dual
  3.  
  4.  
Jun 9 '08 #6
r035198x
13,262 8TB
..Btw, the best way would be:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT '('||TO_CHAR(ABS(-5800.0),'9999.99')||')' from dual
  3.  
  4.  
Not unless they have both negative and positive numbers and want to format their negative numbers that way.
Jun 9 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Douglas | last post: by
reply views Thread by Josh Harris | last post: by
2 posts views Thread by Steve Peterson | last post: by
29 posts views Thread by james | last post: by
4 posts views Thread by Brian Henry | last post: by
1 post views Thread by womblesjc | last post: by
109 posts views Thread by jmcgill | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.