SQLines provides tools to help you convert database schema (DDL), views, queries and SQL scripts from Oracle to Snowflake.
Databases:
Oracle DATE arithmetic:
Oracle | MariaDB | |||
1 | SYSDATE + 1 | Add 1 day | DATEADD(DAY, 1, CURRENT_TIMESTAMP(0)) | |
2 | SYSDATE + 1/24 | Add 1 hour | DATEADD(HOUR, 1, CURRENT_TIMESTAMP(0)) | |
3 | SYSDATE + 1/1440 | Add 1 minute | DATEADD(MINUTE, 1, CURRENT_TIMESTAMP(0)) | |
4 | SYSDATE + 1/86400 | Add 1 second | DATEADD(SECOND, 1, CURRENT_TIMESTAMP(0)) |
Converting string functions:
Oracle | Snowflake | ||
1 | INSTR(str, substr, pos, occur) | Get the position of substring | REGEXP_INSTR(str, substr, pos, occur) |
Converting date and time functions:
Oracle | Snowflake | ||
1 | MONTHS_BETWEEN(dt1, dt2) | Get difference in months | MONTHS_BETWEEN(dt1, dt2) |
2 | SYSDATE | Get the current date and time ![]() | CURRENT_TIMESTAMP(0) |
3 | TO_CHAR(datetime, format) | Convert a datetime to string | TO_CHAR(datetime, format) |
4 | TO_DATE(str, format) | Convert a string to date and time ![]() | TO_TIMESTAMP(str, format) |
5 | TRUNC(datetime) | Truncate a datetime value | TRUNC(datetime) ![]() |