Why doesn't my SQL SQL SELECT statement print the decimal value?
3 answers
I am assuming you are using SQL * PLUS. The reason you don't see the rest of the number is because of the parameter value numwidth
. The default is 10, so you need to tweak it a bit, for example 30. Here's an example:
SQL> select (4*(22/7)*3958.759*3958.759) as "Earth Area" from dual;
Earth Area
------------
197016573
SQL> set numwidth 31
SQL> select (4*(22/7)*3958.759*3958.759) as "Earth Area" from dual;
Earth Area
----------------
197016572.595304
Also you can override the parameter value with numwidth
either set numformat
orcolumn format
+4
source to share
This is SQL * Plus and has nothing to do with what is returned from the database. You can use the SQL * Plus column formatting commands to get the formats you want, for example:
SQL> select (4*(22/7)*3958.759*3958.759) as "Earth Area" from dual;
Earth Area
------------
197016573
SQL> col "Earth Area" for 99,999,999,999.9999999
SQL> /
Earth Area
-----------------------
197,016,572.5953040
Oracle documentation with more information on formatting options here .
+2
source to share