i want to show numeric digits as given below by using an oracle query:
1000000 1M
22000 22k
Please help is there any way to do it in oracle query??
i want to show numeric digits as given below by using an oracle query:
1000000 1M
22000 22k
Please help is there any way to do it in oracle query??
I don't think there's a standard function (except for the scientific notation), but you can define such a function yourself:
SQL> WITH DATA AS (SELECT power(10, ROWNUM) num FROM dual CONNECT BY LEVEL <= 9)
2 SELECT num,
3 CASE
4 WHEN num >= 1e6 THEN
5 round(num / 1e6) || 'M'
6 WHEN num >= 1e3 THEN
7 round(num / 1e3) || 'k'
8 ELSE to_char(num)
9 END conv
10 FROM DATA;
NUM CONV
---------- -----------------------------------------
10 10
100 100
1000 1k
10000 10k
100000 100k
1000000 1M
10000000 10M
100000000 100M
1000000000 1000M