VARCHAR2 Data Type - Oracle to MySQL Migration

In Oracle, the VARCHAR2(n) data type stores variable-length character strings up to n bytes (default) or characters with the maximum of 4000 or 32,767 bytes if MAX_STRING_SIZE initialization parameter is set to EXTENDED (not set by default).

In MySQL, you can use VARCHAR(n) that can store up to 65,535 characters. But effective maximum length is subject to the maximum row size limit of 65,535 bytes (shared among all columns) and the character set used.

Oracle:

  CREATE TABLE specs
  (
    note   VARCHAR2(30),
    name VARCHAR2(100 CHAR),
    item   VARCHAR2(50 BYTE)
  );

MySQL:

  CREATE TABLE specs
  (
    note   VARCHAR(30),
    name VARCHAR(100),
    item   VARCHAR(50)
  );

Overview

Conversion summary:

Oracle MySQL
Syntax VARCHAR2(n [CHAR | BYTE]) VARCHAR(n)
Parameter n is the number of characters or bytes (default) n is the number of characters
Range 1 ⇐ n ⇐ 4000 or 32,767 (if MAX_STRING_SIZE=EXTENDED) 0 ⇐ n ⇐ 65,535
(with 65,535 bytes row limit )
Default n must be specified n must be specified

For more information, see Oracle to MySQL Migration.