float datatype in Oracle database 【Blog 搬家】
float datatype in Oracle database
2005 年 08 月 25日, 星期四
作了一個測試,就像我們以前一直提醒的一樣。在使用非 number datatype 的 數字型別一定要注意。
create table t_float (f float(2),n number(2))
SQL> insert into t_float values (7,7);
1 row created.
SQL> insert into t_float values (11,11);
1 row created.
SQL> insert into t_float values (99,99)
1 row created.
1 row created.
SQL> select * from t_float;
F N
---------- ----------
7 7
10 11
100 99
---------- ----------
7 7
10 11
100 99
Why:
a FLOAT column with a binary precision of 2 bits, is implemented as a NUMBER column with 1 decimal digit of precision and no fixed scale. Thus the number 7, which requires 3 binary bits, will nevertheless be stored exactly, whereas the number 11, which has two decimal digits, will be rounded to 10 because only one decimal digit of precision is allowed.
It is legitimate for a database implementation to use higher precision than requested in this way. Therefore, database applications should always round data values explicitly when required, and should not rely on the precision of the datatype to round data implicitly.
暫時還有理解上面的含義 :(
myhuaer 發表於:2005.08.25 10:39 ::分類: ( Oracle Infomation ) ::閱讀:(470次)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/34596/viewspace-661931/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle實驗(04):floatOracle
- Oracle clone databaseOracleDatabase
- ORACLE database vaultOracleDatabase
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- Oracle Physical Database LimitsOracleDatabaseMIT
- Oracle Database Scheduler整理OracleDatabase
- Good site on Oracle tech blogGoOracle
- WPF DataTemplate DataType
- partitioned by timestamp datatype
- Oracle 12.2 使用Database Link優化Standby Database WorkloadOracleDatabase優化
- Oracle 19c Concepts(01):Introduction to Oracle DatabaseOracleDatabase
- Oracle 19c Concepts(13):Oracle Database InstanceOracleDatabase
- Oracle DG Standby Database型別OracleDatabase型別
- Oracle DG建立Physical Standby DatabaseOracleDatabase
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- oracle 10g flashback databaseOracle 10gDatabase
- Oracle OCP(35):Database 安裝OracleDatabase
- Oracle 12C Database File Mapping for Oracle ASM FilesOracleDatabaseAPPASM
- [翻譯]-Detect And Repair Corruption in an Oracle DatabaseAIOracleDatabase
- Oracle 19c Database Management ToolsOracleDatabase
- Oracle OCP(38):Database 物理結構OracleDatabase
- 關於Oracle Database Vault介紹OracleDatabase
- Scheduler in Oracle Database 10g(轉)OracleDatabase
- Oracle 19c Concepts(00):Changes in This Release for Oracle Database ConceptsOracleDatabase
- 【Oracle】Windows安裝oracle11gR1 database 11.1.0.6OracleWindowsDatabase
- Sqlcl 連線Oracle DataBase 19cSQLOracleDatabase
- 1 Oracle Database 19c 新特性OracleDatabase
- Oracle OCP(37):Database 體系結構OracleDatabase
- Converting Oracle Database from Linux to Windows using RMANOracleDatabaseLinuxWindows
- Oracle database 升級(文件)to 10.2.0.4 from 10.2.0.1OracleDatabase
- Migration Of An Oracle Database Across OS Platforms [ID 733205.1]OracleDatabaseROSPlatform
- Oracle Database 19c安裝Sample SchemasOracleDatabase
- G009-ORACLE-ASK Using In-Database ArchivingOracleDatabase
- 1 Oracle Database Release 20c New FeaturesOracleDatabase
- 【PDB】Oracle 建立pdb說明(create pluggable database)OracleDatabase
- Oracle 19c Concepts(18):Concepts for Database AdministratorsOracleDatabase
- Oracle 19c Concepts(19):Concepts for Database DevelopersOracleDatabaseDeveloper
- Oracle OCP(39):Database 記憶體結構OracleDatabase記憶體
- [20181007]Scalable sequences oracle database 12c.txtOracleDatabase