Skip to content

Instantly share code, notes, and snippets.

@jabley
Created July 12, 2012 10:43
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jabley/3097350 to your computer and use it in GitHub Desktop.
Save jabley/3097350 to your computer and use it in GitHub Desktop.
Help convert Oracle DDL to MySQL
s/NUMBER(22,0)/BIGINT/
s/NUMBER(9,0)/INT/
s/NUMBER(8,0)/INT/
s/NUMBER(6,0)/MEDIUMINT/
s/NUMBER(5,0)/SMALLINT/
s/NUMBER(3,0)/TINYINT/
s/NUMBER(2,0)/TINYINT/
s/NUMBER(1,0)/BIT/
s/NUMBER(16,2)/DECIMAL(16,2)/
s/NUMBER(11,2)/DECIMAL(11,2)/
s/NUMBER(9,2)/DECIMAL(9,2)/
s/NUMBER(7,2)/DECIMAL(7,2)/
s/NUMBER(5,2)/DECIMAL(5,2)/
s/NUMBER(4,2)/DECIMAL(4,2)/
s/NUMBER/BIGINT/
s/VARCHAR2/VARCHAR/
s/"//g
s/--.*//
@jabley
Copy link
Author

jabley commented Jul 12, 2012

$ sed -f oracle2mysql.sed oracle-ddl.sql > mysql-ddl.sql

@slevine
Copy link

slevine commented Sep 25, 2012

Thanks for sharing -- found the script very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment