Mehmet
Mehmet

Reputation: 2278

Number format converting

I have a currency amount value like this;

22200000

I want to convert this number to;

22,2  (Number format)

How can I do this?

Upvotes: 2

Views: 14681

Answers (3)

user5100320
user5100320

Reputation:

You can use Oracle Built-in function round().

The ROUND function accepts a number and returns another number rounded to the specified number of places to the right of the decimal point. If you do not specify that number, ROUND will return a number rounded to the nearest integer

For instance:

    select 1/3, round(1/3, 2) from dual;

       1/3 ROUND(1/3,2)
---------- ------------
.333333333          .33

More info: Working with Numbers in PL/SQL

Upvotes: 1

Mehmet
Mehmet

Reputation: 2278

I found the answer: SELECT TO_CHAR (22200000 / 1000000, '999,999,999,999.99') FROM dual

Upvotes: 3

Ravindra Bagale
Ravindra Bagale

Reputation: 17655

use to_char() function. Example

to_char(3510.78, '$9,999.00') 

would return

 $3,510.78

Upvotes: 5

Related Questions