Note: This page is a work-in-progress and is not comprehensive or 100% accurate.
| Oracle | PostgreSQL | |
|---|---|---|
Numeric types |
||
| Integer (2 bytes) | ~ NUMBER(5,0) |
smallint |
| Integer (4 bytes) | ~ NUMBER(10,0) |
integer |
| Integer (8 bytes) | ~ NUMBER(20,0) |
bigint |
| Fixed-point decimal (defined precision and scale) | NUMBER(precision, scale=0) |
numeric(precision, scale=0) |
| Fixed-point decimal (arbitrary precision and scale) |
NUMBER
|
numeric
|
| Floating-point decimal (defined precision, arbitrary scale) | FLOAT(precision=126 binary digits) |
No equivalent |
| Floating-point binary (32-bit) | BINARY_FLOAT |
~ real |
| Floating-point binary (64-bit) | BINARY_DOUBLE |
~ double precision |
Character types |
||
| Variable-length text |
VARCHAR2(size)
|
character varying(n), varchar(n)
|
| Fixed-length, padded |
CHAR(size=1)
|
character(n), char(n)
|
| Variable-length "unlimited" | CLOB |
text |
Boolean |
||
| Boolean true/false |
No exact equivalent NUMBER(1,0) or CHAR(1) with Y/N
|
boolean
|
Date / Time types |
||
| date and time (with timezone) |
TIMESTAMP WITH TIME ZONE
|
timestamp with time zone
|
| date and time (no timezone) |
TIMESTAMP
|
timestamp [without time zone]
|
| date and time (with timezone, automatic conversion) |
TIMESTAMP WITH LOCAL TIME ZONE
|
No equivalent |
| date only |
DATE
|
date
|
| time of day (no date) |
No exact equivalent INTERVAL DAY(0) TO SECOND
— via stackoverflow |
time [without time zone]
|
| time of day (no date, with time zone) | No equivalent |
time with time zone
|
| time interval |
|
interval
|
Binary data |
||
| variable-length binary string |
BLOB
|
bytea
|
Monetary types |
||
| fixed-precision currency |
NUMBER(precision, scale)
|
money
precision depends on lc_monetary setting |
Enumerated types |
||
| Enumeration |
Not supported. Use CHAR or VARCHAR2 with a CHECK constraint. e.g. |
Type must first be defined: CREATE TYPE typename AS ENUM ('value1', 'value2', ...)
|