Oracle舍入问题
我正在使用此代码将十进制值向下舍入到25的下一个倍数。
即如果值为33.60,则应该舍入到33.50
create or replace
PROCEDURE "TEST1" (PQUERY IN VARCHAR2) as
prNspValue number(14,2) :='';
p_percentage_Value number(4,2) :='';
begin
prNspValue:=33.60;
dbms_output.put_line(prNspValue);
p_percentage_Value:=substr(prNspValue,instr(prNspValue,'.')+1,length(prNspValue));
dbms_output.put_line(p_percentage_value);
p_percentage_Value:=p_percentage_Value-mod(p_percentage_Value,25);
dbms_output.put_line(p_percentage_value);
if(p_percentage_Value!=0)then
prNspValue:=substr(prNspValue,1,instr(prNspValue,'.'))+p_percentage_Value/100;
else
prNspValue:=substr(prNspValue,1,instr(prNspValue,'.'));
end if;
dbms_output.put_line(prNspValue);
end;
但问题是当值为33.60时,它被视为33.6。所以它将它四舍五入到33.0。
我该如何更正此代码?
没有找到相关结果
已邀请:
1 个回复
厢界山攀
: