Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Incorrect quotes in migration generated master.sql DDL statements

Allain LegacyJan 17 2024 — edited Jan 17 2024

Generating offline migration scripts from MySQL to Oracle results in a master.sql file that contains DDL that cannot be run in sqlplus. The first two observed errors when trying to execute the master.sql are related to what appears to be extra single quotes (1st example), and unnecessary single quotes (2nd example).

I've searched thru the preferences/settings but haven't found anything that could explain this behaviour.

First example:

SQL> ALTER TABLE MY_TABLE_NAME MODIFY (MY_FIELD_NAME DEFAULT ''foo'');
ALTER TABLE MY_TABLE_NAME MODIFY (MY_FIELD_NAME DEFAULT ''foo'')
                                                          *
ERROR at line 1:
ORA-00907: missing right parenthesis

In this next example, the source table definition has 'foo' as the column default, so I'm not clear as to why the tool thought it needed to quote it. This is the field definition in the source database:

  `MY_FIELD_NAME` varchar(255) NOT NULL DEFAULT 'foo',  

Second example:

SQL> ALTER TABLE MY_TABLE_NAME MODIFY (MY_OTHER_FIELD_NAME DEFAULT 'NULL');
ALTER TABLE MY_TABLE_NAME MODIFY (MY_OTHER_FIELD_NAME DEFAULT 'NULL')
                                                              *
ERROR at line 1:
ORA-01722: invalid number

In this example, the source table definition has NULL as the default value which, based on the generated DDL in master.sql, seems to be interpreted as a string 'NULL' instead of a true NULL or (null) value. This is the column definition:

 `MY_OTHER_FIELD_NAME` decimal(13,6) DEFAULT NULL,

SQL Developer version: Oracle IDE 23.1.1.345.2114

MySQL connection: mysql-connector-j-8.2.0.jar

Comments
Post Details
Added on Jan 17 2024
0 comments
230 views