문제

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

도움이 되었습니까?

해결책

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>

Number Format Models

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top