oracle-databasevarchar2nclob

Convert from VARCHAR2 to NCLOB (oracle)


I got a column message with data_type = VARCHAR2. It already has some data stored. I want this column to be of type NCLOB. Code-Set for this column should be UTF-8.

I did the following:

Then i tried out my integration tests and i got the exception: java.sql.BatchUpdateException: ORA-01400: Insert of NULL into ("BATCH_LOG"."MESSAGEOLD") not possible.

What have I done wrong?


Solution

  • The original column was defined as NOT NULL, when you renamed that to MESSAGEOLD, this constraint was kept. You need to remove the NOT NULL constraint from the MESSAGEOLD column:

    ALTER TABLE foo MODIFY MESSAGEOLD NULL;