Home > Net >  After decimal only show 4 digit while selecting whole table in Oracle
After decimal only show 4 digit while selecting whole table in Oracle

Time:06-21

I have a report in which values like 222.4444444444444 is displayed. Now I want to display it like 222.4444

The issue is that I want it for all the table columns and there are 33 columns.

SELECT * FROM IPFEE_MST_INSRT_ASCEND

CodePudding user response:

Use TO_CHAR and list all the columns:

SELECT TO_CHAR(col1, 'fm99990D0000') AS col1,
       TO_CHAR(col2, 'fm99990D0000') AS col2,
       TO_CHAR(col3, 'fm99990D0000') AS col3,
       TO_CHAR(col4, 'fm99990D0000') AS col4
FROM   table_name

CodePudding user response:

You can round this number by the round() function. round(number,how_many_decimal_places_number_will_be_rounded)

SELECT round(222.444444444,4) FROM dual;

As you have more columns, you have to write this function separately for all columns. i.e SELECT round(column1,4),round(column2,4) from table_name;

  • Related