SQLFormatter
FormatterConvertPricingDocsGet Pro
SQL Converter · OraclePostgreSQL

Convert Oracle SQL to PostgreSQL

Migrating Oracle to PostgreSQL means swapping ROWNUM paging for LIMIT, NVL for COALESCE, SYSDATE for now(), and dropping the DUAL table. A mechanical formatter only re-indents — it won’t rewrite dialect-specific syntax. The AI converter in the app translates the query and the table below shows exactly what changes.

Oracle — source
Oracle
SELECT e.employee_id,
       NVL(e.commission_pct, 0) AS comm
FROM employees e
WHERE e.hire_date > SYSDATE - 30
  AND ROWNUM <= 20
ORDER BY e.hire_date DESC;
PostgreSQL — converted
PostgreSQL
SELECT e.employee_id,
       COALESCE(e.commission_pct, 0) AS comm
FROM employees e
WHERE e.hire_date > now() - INTERVAL '30 days'
ORDER BY e.hire_date DESC
LIMIT 20;
Convert your own query

What changes from Oracle to PostgreSQL

OraclePostgreSQLWhy
ROWNUM <= 20LIMIT 20Postgres has no ROWNUM; row limiting moves to a LIMIT clause.
NVL(x, 0)COALESCE(x, 0)NVL is Oracle-only; COALESCE is the SQL-standard equivalent.
SYSDATE - 30now() - INTERVAL '30 days'Date arithmetic uses interval literals in Postgres.
FROM dual(omitted)Postgres allows SELECT with no FROM, so DUAL disappears.

Other SQL conversions

T-SQLPostgreSQLMySQLPostgreSQLOracleMySQLOracleSnowflakeRedshiftPostgreSQLAll conversions →