Thread: Number format for shorthand money values

This question is answered.


Permlink Replies: 8 - Pages: 1 - Last Post: May 5, 2009 4:47 PM Last Post By: jgarry
james.elsey

Posts: 6
Registered: 05/15/08
Number format for shorthand money values
Posted: Apr 23, 2009 2:42 AM
 
Click to report abuse...   Click to reply to this thread Reply
Hi,

How can I format currency values to shorthand?

ie how can I display 12500 as 12.5, 2700 as 2.7, 700 as 0.7 etc?

I have tried using various masks but can't achieve the results I'm looking for

Thanks

J
Alex Nuijten

Posts: 4,792
Registered: 02/12/00
Re: Number format for shorthand money values
Posted: Apr 23, 2009 2:53 AM   in response to: james.elsey in response to: james.elsey
 
Click to report abuse...   Click to reply to this thread Reply
what have you tried? Before we start offering the same suggestions...
Boneist

Posts: 3,292
Registered: 04/26/07
Re: Number format for shorthand money values
Posted: Apr 23, 2009 2:56 AM   in response to: james.elsey in response to: james.elsey
Correct
Click to report abuse...   Click to reply to this thread Reply
This?

with my_tab as (select 2700 col1 from dual union all
                select 12500 col1 from dual union all
                select 700 col1 from dual)
-- end of mimicking your data; USE SQL below:
select col1 / 1000
from   my_tab;
 
 COL1/1000
----------
       2.7
      12.5
        .7
michaels2

Posts: 5,875
Registered: 09/24/06
Re: Number format for shorthand money values
Posted: Apr 23, 2009 3:10 AM   in response to: james.elsey in response to: james.elsey
Helpful
Click to report abuse...   Click to reply to this thread Reply
SQL>  select to_char(n/1000,'90.9') n 
  from (
        select 12500 n from dual union all
        select 2700 n from dual union all
        select 700 n from dual
       )
/ 
N    
-----
 12.5
  2.7
  0.7
 
3 rows selected.
james.elsey

Posts: 6
Registered: 05/15/08
Re: Number format for shorthand money values
Posted: Apr 24, 2009 1:33 AM   in response to: Boneist in response to: Boneist
 
Click to report abuse...   Click to reply to this thread Reply
Thanks for the replies guys

I wasnt aware of the "/1000" feature, but it has done exactly what I need

Brownie points to you both

;)

Radhakrishna Sa...

Posts: 2,865
Registered: 01/25/06
Re: Number format for shorthand money values
Posted: Apr 24, 2009 1:37 AM   in response to: james.elsey in response to: james.elsey
 
Click to report abuse...   Click to reply to this thread Reply
james.elsey wrote:
I wasnt aware of the "/1000" feature, but it has done exactly what I need

Were you not aware? Great! Have you heard about "Mathematics" ever?

Cheers
Sarma.

Boneist

Posts: 3,292
Registered: 04/26/07
Re: Number format for shorthand money values
Posted: Apr 24, 2009 1:44 AM   in response to: Radhakrishna Sa... in response to: Radhakrishna Sa...
 
Click to report abuse...   Click to reply to this thread Reply
Radhakrishna Sarma wrote:
Were you not aware? Great! Have you heard about "Mathematics" ever?

LOL!
F the Paks

Posts: 1
Registered: 05/01/09
Re: Number format for shorthand money values
Posted: May 1, 2009 6:02 AM   in response to: Radhakrishna Sa... in response to: Radhakrishna Sa...
 
Click to report abuse...   Click to reply to this thread Reply
"Were you not aware? Great! Have you heard about "Mathematics" ever?

Cheers
Sarma."

......................

SELECT idiot FROM i_dont_care WHERE forum_post != my_business AND cheap_dig = TRUE
jgarry

Posts: 576
Registered: 07/20/98
Re: Number format for shorthand money values
Posted: May 5, 2009 4:47 PM   in response to: Radhakrishna Sa... in response to: Radhakrishna Sa...
 
Click to report abuse...   Click to reply to this thread Reply
Okay geniuses, predict this:

set numw 50
select 1/3*3*100000/1000 from dual;
select 1/3*3*100 from dual;
select 1/3*3*1000 from dual;

(hat tip to OCM Laurent for giving the idea for that)
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums