Friday 21 November 2008

Compare SQL Server and Oracle Numeric Data Types

Number data types aren't so easy to directly compare. Oracle has one main data type, NUMBER, which is equivilent to SqlServer NUMERIC.













SQL Server Oracle
NUMERIC / DECIMAL Maximum precision of 38 digits NUMBER Maximum precision of 38 digits


SqlServer also has number data types that are sized in bytes not precision, which have no direct equivalent in Oracle.












Data TypeMinMaxBytesNear Oracle Equivalent
BIGINT-9,223,372,036,854,775,8089,223,372,036,854,775,8078BINARY_DOUBLE
INT-2,147,483,6482,147,483,6474BINARY_FLOAT
SMALLINT-32,76832,7672NUMBER(5,0)
TINYINT02551NUMBER(3,0)
FLOAT-1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+3084 or 8BINARY_DOUBLE
REAL-3.40E+38 to -1.18E-38, 0 and 1.18E-38 to 3.40E+384BINARY_FLOAT
MONEY-922,337,203,685,477.5808922,337,203,685,477.58078NUMBER(19,4)
SMALLMONEY-214,748.3648214,748.36474NUMBER(10,4)


Oracle also has data types FLOAT, DECIMAL and INTEGER, however these are ANSI synonyms which refer back to the NUMBER data type with specific precisions.

See also: Compare Lob Data Types, Compare Character Data Types

No comments: