游标执行后数字格式不正确(.0115 而不是 0.115)

Incorrect number format (.0115 instead of 0.115) after the cursor execution

我尝试执行此代码,但在 output.I 中得到了不正确的数字类型output.I我尝试更改(精度、比例)源 table 更改 NLS_NUMERIC_CHARACTERS 但没有结果。

SET SERVEROUTPUT ON;
DECLARE
--Declare variables
  v_pr number ;
  v_fin number ;
--Declare cursor 
CURSOR cur_price IS
  SELECT price FROM prices;
BEGIN
OPEN cur_price; 
LOOP      --Simple Loop Start
  FETCH cur_price INTO v_pr; 
  v_fin := v_pr * 1.15; --Calculation
  DBMS_OUTPUT.PUT_LINE (to_char(v_pr) ||' --> '|| to_char(v_fin));  --Show the result
  EXIT WHEN cur_price%NOTFOUND; 
END LOOP; --Simple Loop End
CLOSE cur_price;
END;
-----------------
.01 --> .0115
.02 --> .023
.03 --> .0345
.03 --> .0345

Table 参数:

select * from prices
----------------
0.01
0.02
0.03


desc prices
Name  Null? Type        
----- ----- ----------- 
PRICE       NUMBER(6,3)

NLS 参数:

select value
from nls_session_parameters
where parameter = 'NLS_NUMERIC_CHARACTERS';

VALUE
-------------------------------
.,

Oracle 数据库以可变长度格式存储数字数据。每个值都以科学记数法存储,其中 1 个字节用于存储指数。数据库最多使用 20 个字节来存储尾数,这是包含有效数字的浮点数的一部分。 Oracle 数据库不存储前导零和尾随零。

SQL> create table prices ( price number(6,3) );

Table created.

SQL> insert into prices values ( 0.293 );

1 row created.

SQL> commit;

Commit complete.

SQL> select * from prices;

     PRICE
----------
      .293

SQL> alter session set nls_numeric_characters=',.' ;

Session altered.

SQL> select * from prices;

     PRICE
----------
      ,293

SQL> SET SERVEROUTPUT ON;
DECLARE
--Declare variables
  v_pr number ;
  v_fin number ;
--Declare cursor
CURSOR cur_price IS
  SELECT price FROM prices;
BEGIN
OPEN cur_price;
LOOP      --Simple Loop Start
  FETCH cur_price INTO v_pr;
  v_fin := v_pr * 1.15; --Calculation
  DBMS_OUTPUT.PUT_LINE (to_char(v_pr) ||' --> '|| to_char(v_fin));  --Show the result
  EXIT WHEN cur_price%NOTFOUND;
END LOOP; --Simple Loop End
CLOSE cur_price;
END;
/

,293 --> ,33695
,293 --> ,33695