简体   繁体   English

Oracle中的十进制数据类型

[英]decimal data type in Oracle

My database table contains one column of varchar2(20,10) , but since it is a total amount field I need currency data type. 我的数据库表包含一列varchar2(20,10) ,但是由于它是总额字段,因此我需要货币数据类型。 (If I enter 1235.5 it should take it as 1235.50.) (如果我输入1235.5,则应将其设为1235.50。)

I tried changing to type number(20,2) , I am not able to do this with number(20,2) in Oracle 10g. 我尝试更改为number(20,2)类型,但在Oracle 10g中无法使用number(20,2)做到这一点。

I guess you need not bother about insert, as long you have a precision of atleast 2. When you are fetching using select query, try using the select query as : 我猜您不必担心插入,只要您具有至少2的精度即可。在使用select查询进行抓取时,请尝试将select查询用作:

Select to_char(1234.4, 'fm9999999.00') from dual; 
Select to_char(1234.45, 'fm9999999.00') from dual; 
Select to_char(1234,'fm9999999.00') from dual;
Select to_char(1234.4567, 'fm9999999.00') from dual;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM