Oracle to PostgreSQL Converter
Paste Oracle DDL or SQL and get PostgreSQL-compatible SQL back. The converter maps VARCHAR2, NUMBER, DATE, CLOB and BLOB types, rewrites NVL, NVL2, DECODE, SYSDATE, sequence NEXTVAL, ROWNUM and FROM DUAL, strips TABLESPACE, STORAGE and other physical clauses, and lists every construct that still needs a human decision. Rule-based and browser-only: nothing is uploaded.
Conversion runs entirely in your browser with rule-based rewrites; no SQL is sent to a server. It is best-effort, so review the output before running it.
Do more than oracle to postgresql converter — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Paste Oracle CREATE TABLE / CREATE SEQUENCE / CREATE INDEX statements or queries, or click Load example.
- Choose whether to lowercase quoted identifiers and whether DATE should become TIMESTAMP(0), then click Convert to PostgreSQL.
- Read the line-numbered warnings, fix the flagged parts, then run the result against PostgreSQL.
Frequently asked questions
What does the Oracle to PostgreSQL converter translate automatically?
Data types (VARCHAR2/NVARCHAR2, CHAR/NCHAR, NUMBER with precision-based INTEGER/BIGINT/NUMERIC mapping, FLOAT, BINARY_DOUBLE, DATE, TIMESTAMP WITH LOCAL TIME ZONE, CLOB, BLOB, RAW, LONG, XMLTYPE), quoted uppercase identifiers, NVL, NVL2, DECODE, SYSDATE, SYSTIMESTAMP, seq.NEXTVAL/CURRVAL, INSTR, LENGTHB, TO_NUMBER, TRUNC(date), ADD_MONTHS, LISTAGG, MINUS, simple ROWNUM filters and FROM DUAL, plus CREATE SEQUENCE options and Oracle storage clauses such as TABLESPACE, STORAGE, PCTFREE, LOGGING and ENABLE.
Why does Oracle DATE become TIMESTAMP(0)?
An Oracle DATE always stores a time of day down to the second, while a PostgreSQL DATE stores only the calendar day. Mapping to TIMESTAMP(0) keeps every value intact. If your columns only ever hold midnight values, untick the option to keep DATE. Remember that Oracle date arithmetic such as created_at + 1 becomes created_at + INTERVAL '1 day' in PostgreSQL.
What about PL/SQL, (+) joins and full database migrations?
PL/SQL packages, procedures and triggers, (+) outer joins, CONNECT BY and MONTHS_BETWEEN are flagged rather than rewritten. For a full-scale migration of schemas, code and data, use ora2pg. To run and validate the converted SQL, Chat2DB (https://chat2db.ai/download) connects to both Oracle and PostgreSQL in one client, so you can compare results side by side.
