Convert Mermaid ER to Oracle

Generate production-ready Oracle SQL code from your Mermaid ER diagrams in seconds.

oracle
Dialect: oracleTables: 2
Done.
mermaid
Live preview mermaid

How the Mermaid ER to Oracle conversion works

Mermaid erDiagram is a Markdown-friendly notation rendered natively by GitHub, GitLab, Notion, and Obsidian β€” which makes it the most common way to keep an ER diagram next to the code it describes.

Entities are blocks of `type name marker` lines (markers: PK, FK, UK, INDEX), and relationships use cardinality arrows like `USER ||--o{ POST : writes` β€” one-to-many from USER to POST. The converter reads both, plus comment directives for everything the base syntax can't express.

Paste your Mermaid ER source into the editor above and the engine parses it into an intermediate schema β€” tables, columns, relationships, indexes β€” then generates Oracle DDL from that model. Anything the diagram syntax can't express (NOT NULL, defaults, enums, CHECK constraints, composite indexes) you add with comment directives like %% ::NN, ::DEFAULT(now()) on the line above a column. The Mermaid ER reference documents the full vocabulary.

What the generator emits for Oracle

  • CREATE TABLE statements with double-quoted identifiers for Oracle 19c+
  • VARCHAR2, NUMBER, and CLOB types sized for Oracle conventions
  • CHECK ("col" IN (…)) constraints for ::ENUM(...) columns
  • ALTER TABLE … ADD CONSTRAINT foreign keys with deterministic names
  • COMMENT ON TABLE / COMMENT ON COLUMN statements

Type mapping: Mermaid ER to Oracle

Diagram column types are logical β€” the generator maps each one to the idiomatic Oracle type. These are the exact mappings the engine uses:

Diagram typeOracle typeNotes
intNUMBER
stringVARCHAR2(255)use varchar(n) in the diagram to control length
textCLOB
decimalNUMBERdecimal(10,2) passes precision through
booleanNUMBER(1)Oracle has no boolean column type
dateDATEOracle DATE includes time-of-day
timestampTIMESTAMP
uuidRAW(16)compact binary storage
bigintNUMBER(19)
floatBINARY_DOUBLE

Keys, relationships, and enums

Primary keys emit as NUMBER columns with PRIMARY KEY constraints. Auto-increment uses Oracle conventions rather than a SERIAL keyword, and composite keys emit a table-level constraint.

Relationships emit `ALTER TABLE … ADD CONSTRAINT fk_<table>_<column>` statements after all tables exist, with ON DELETE actions from the ::RELATIONSHIP directive.

Oracle has no enum type, so `::ENUM(active, inactive)` emits `VARCHAR2(255) CHECK ("status" IN ('active', 'inactive'))` β€” enforced at the database level via the CHECK constraint.

Frequently asked questions

How does the converter handle booleans for Oracle?

As NUMBER(1) β€” Oracle has no boolean column type in SQL. 0/1 is the standard convention and maps cleanly to booleans in every Oracle driver.

What do enum columns become in Oracle DDL?

VARCHAR2(255) with a CHECK (col IN (…)) constraint. You keep database-level validation even though Oracle has no native enum type.

Why RAW(16) for UUID columns?

RAW(16) stores the UUID in its compact 16-byte binary form, which is the conventional Oracle representation and indexes efficiently. Use a string type in the diagram if you prefer the 36-character text form.

Is the output compatible with older Oracle versions?

The DDL targets Oracle 19c+. Most of it runs on older versions, but test first β€” identity and constraint syntax details changed across releases.

Related conversions