Displaying number before decimal points in oracle
-
13-03-2021 - |
Question
I have a logic where I want to calculate and display numbers based upon some operations. The operations are below
V_CALPERCENT nvarhcar(100)
, v_yearMSA1 nvarchar(100)
,
So I want to calculate V_CALPERCENT
and I have one value for v_yearMSA1 = 2
SO here goes my calculation,
V_CALPERCENT := (v_yearMSA1 * 2.25) / 100
Its returning me as .05
where as I want it should also display the number before decimal point. How to get it please help
Solution
Example:
SQL> select to_char((2 * 2.5) / 100) from dual;
TO_
---
.05
SQL> select to_char((2 * 2.5) / 100, '99990D99') from dual;
TO_CHAR((
---------
0.05
SQL>
Update:
Number example:
SQL> select (2 * 2.5) / 100 as mynum from dual;
MYNUM
----------
.05
SQL> col mynum format 99990D99
SQL> select (2 * 2.5) / 100 as mynum from dual;
MYNUM
---------
0.05
SQL>
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange