maniram reddy
maniram reddy

Reputation: 7

How to convert a number into a format which will be separated by comma's by position in sql

declare
a number

begin 

  a:=10000

  dbms_put_line(a)
end:

I want to get my output as 10,000.Please help Thanks in advance

Upvotes: 0

Views: 84

Answers (2)

Fact
Fact

Reputation: 2410

You can do it this way.

begin
    DBMS_OUTPUT.put_line(to_char(a,'99,99,99,999')) ;
end;

Upvotes: 0

Rustam Pulatov
Rustam Pulatov

Reputation: 665

Try this:

select rtrim(to_char(10000, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS=''.,'''), '.')   from dual

the optional third NLS argument to the to_char() function to set the G and D

Upvotes: 2

Related Questions