This is an old revision of the document!
SQLines open source tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, packages, triggers, queries and SQL scripts from Oracle to MariaDB.
We also help convert embedded SQL statements in C/C++ (ODBC, Pro*C, OCI, OCCI), C#, Java, PowerBuilder, VB/VB.NET, ASP/ASP.NET, Perl, PHP, Python, Linux shell and other applications.
Databases:
Starting from MariaDB 10.3 there is the Oracle compatibility mode, see Oracle to MariaDB Migration - Compatibility Mode.
Character data types:
1 | CLOB | Character large object, ⇐ 4G | LONGTEXT |
Numeric data types:
1 | DECIMAL(p,s), DEC(p,s) | Fixed-point number | DECIMAL(p,s), DEC(p,s) |
Date and time data types:
Oracle | MariaDB | |||
1 | DATE | Date and time with seconds | DATETIME |
Binary data types:
1 | BLOB | Binary large object, ⇐ 4G | LONGBLOB |
Other data types:
1 | XMLTYPE | XML data | LONGTEXT |
Datetime functions:
Oracle | MariaDB | ||
1 | TO_DATE(string, format) | Convert string to datetime | STR_TO_DATE(string, format) |
TO_DATE(string) | CAST(string AS DATETIME) |
Note that sequences are available since MariaDB 10.3
CREATE SEQUENCE and ALTER SEQUENCE statements:
Oracle | MariaDB | |||
1 | CREATE SEQUENCE seqname | CREATE [OR REPLACE] SEQUENCE seqname | ||
2 | ALTER SEQUENCE seqname | ALTER SEQUENCE [IF EXISTS] seqname | ||
3 | INCREMENT BY num | Positive or negative increment, default is 1 | INCREMENT BY num | |
4 | START WITH num | Initial value | START WITH num | |
5 | MAXVALUE num | Maximum value is num | MAXVALUE num | |
NOMAXVALUE | System limit | NOMAXVALUE | ||
6 | MINVALUE num | Minimum value is num | MINVALUE num | |
NOMINVALUE | System limit | NOMINVALUE | ||
7 | CYCLE | Reuse values after reaching the limit | CYCLE | |
NOCYCLE | No reuse, this is default | NOCYCLE | ||
8 | CACHE num | Cache num values, default is 20 | CACHE num | Default is 1000 |
NOCACHE | Values are not preallocated | NOCACHE | ||
9 | ORDER | Guarantee numbers in order of requests | Option not supported, commented | |
NOORDER | No guarantee, this is default | Option not supported, removed as it is default |
Referencing sequence values:
Oracle | MariaDB | |||
1 | seqname.CURRVAL | The current value of seqname | NEXTVAL(seqname) | NEXT VALUE FOR seqname |
2 | seqname.NEXTVAL | The next value of seqname | LASTVAL(seqname) | PREVIOUS VALUE FOR seqname |
Note that in Oracle mode (sql_mode = oracle), you can use the Oracle syntax seqname.CURRVAL and seqname.NEXTVAL to get sequence values in MariaDB.
DROP SEQUENCE statement:
Oracle | MariaDB | |||
1 | DROP SEQUENCE seqname | DROP SEQUENCE [IF EXISTS] seqname |