-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
The Oracle SQL Export feature (shown as "Oracle (Beta)" in the Export menu) generates incomplete or incorrect Oracle SQL. Several schema elements—such as datatypes, default values, enums, and constraints—are not exported using valid Oracle syntax, causing errors when running the generated SQL in an Oracle database (e.g., ORA-00902, ORA-00904, ORA-00942).
To Reproduce
Steps to reproduce:
- Open the DrawDB editor
- Create a table with VARCHAR fields, numeric fields, default values, or foreign keys
- Go to File → Export SQL → Oracle (Beta)
- Run the exported SQL in an Oracle database or online Oracle-compatible compiler
- Oracle reports syntax errors or invalid/unsupported datatypes
Expected behavior
The exported SQL should follow Oracle-specific syntax:
- Use correct Oracle datatypes (
VARCHAR2,NUMBER,CLOB,DATE,BINARY_DOUBLE, etc.) - Correctly export default values (including functions like
SYSDATEorSYSTIMESTAMP) - Generate valid PRIMARY KEY and FOREIGN KEY constraints
- Use Oracle-safe identity/auto-increment syntax
- Convert ENUM fields into CHECK constraints (since Oracle does not support ENUM)
- Avoid DOMAIN definitions (unsupported in Oracle)
- Avoid non-Oracle or cross-dialect SQL keywords
Instead, the current output mixes generic SQL, MySQL, and PostgreSQL-style syntax, resulting in invalid Oracle statements.
Desktop (please complete the following information):
- OS: macOS / Windows / Linux
- Browser: Chrome / Safari / Firefox
- Version: Latest DrawDB version
Additional context
This issue is related to incomplete logic in:
src/utils/exportSQL/oraclesql.js
I am opening this issue to help improve the Oracle export feature and I am willing to work on a PR to fix these problems.