EMPTY_CLOB Function - Oracle to MySQL Migration

In Oracle, the EMPTY_CLOB function creates an empty CLOB locator i.e. an empty (with 0 length), but non-NULL CLOB value.

In MySQL, you can use '' constant (empty string).

Oracle:

  -- A sample table
  CREATE TABLE t1 (
    c1 CLOB DEFAULT EMPTY_CLOB()
  );

MySQL:

  -- A sample table
  CREATE TABLE t1 (
    c1 LONGTEXT DEFAULT ('')
  );
  /* Query OK, 0 rows affected */

Note that for a CLOB column, you have to enclose the DEFAULT value with parentheses, otherwise you will get the error: ERROR 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column can't have a default value.

For more information, see Oracle to MySQL Migration.