Skip to content
Advertisement

Migrating from Oracle to MySQL. VARCHAR2 length defined using bytes. How to port?

I have variable in Oracle procedure declared like this:

How can I port it to mysql? Because this when I try to declare it in MySQL procedure:

MySQL throws me syntax error.


How can I port that Oracle variable definition to MySQL?


It is 256 BYTE part that doesn’t let me to declare variable in MySQL and I need to find something similar to this 256 BYTE expression in MySQL.

Advertisement

Answer

In MySql, varchar colums get declared like this

etcetera. The Oracle syntax is different.

In stored code in MySql, inside function or procedure scope, variables get declared like this:

If you’re not aware of this, you soon will be: Oracle PL/SQL and MySql’s little language for stored code are very different from each other.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement