SQLWays Product Page - Migration to PostgreSQL Free Evaluation

PostgreSQL Data Types - NUMERIC and DECIMAL

Versions: PostgreSQL 8.x and 7.x

PostgreSQL - NUMERIC
Syntax NUMERIC[(p[,s])]
Data Fixed-point numeric data
Parameters p is the maximum number of all digits (both sides of the decimal point), s is the maximum number of digits after the decimal point
Range -1038 to 1038-1, 1 ⇐ p ⇐ 1000, 0 ⇐ s ⇐ p
Default p is 1000, s is 0
Error Handling If the scale of a value is greater than the declared scale, it is rounded to the specified number of fractional digits
Special Values The special case-insensitive value 'NaN' (not-a-number) is allowed
Standards ANSI SQL

DECIMAL is identical to NUMERIC

PostgreSQL - DECIMAL
Standards ANSI SQL

PostgreSQL NUMERIC/DECIMAL - Equivalents in Other Databases

Database Data Type and Conversion
Oracle NUMBER(p,s), 1 ⇐ p ⇐ 38, -84 ⇐ s ⇐ 127
SQL Server DECIMAL(p,s), NUMERIC(p,s), 1 ⇐ p ⇐ 38, 0 ⇐ s ⇐ p
MySQL DECIMAL(p,s), NUMERIC(p,s), 1 ⇐ p ⇐ 65, 0 ⇐ s ⇐ 30
Sybase ASE DECIMAL(p,s), NUMERIC(p,s), 1 ⇐ p ⇐ 38, 0 ⇐ s ⇐ p
Informix DECIMAL(p,s), NUMERIC(p,s), 1 ⇐ p ⇐ 32, 0 ⇐ s ⇐ p
HP Neoview DECIMAL(p,s), 1 ⇐ p ⇐ 18, 0 ⇐ s ⇐ p, NUMERIC(p,s), 1 ⇐ p ⇐ 128, 0 ⇐ s ⇐ p

Related Data Types in PostgreSQL

Data Types
Integers BIGINT INT SMALLINT
Floating-point FLOAT(p) REAL DOUBLE PRECISION

All Data Types

Oracle SQL Server IBM DB2 MySQL PostgreSQL Sybase ASE Sybase ASA Informix DS Teradata HP Neoview Interbase/Firebird


SQLWays Product Page - Migration to PostgreSQL Free Evaluation

Discussion

Enter your comment:
PNSEQ
 
sqlways/postgresql/data-types/decimal_numeric.txt · Last modified: April 25, 2012, 04:46:36 AM (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki