How to change varchar column data type to CLOB

Describe that we have a table and column varchar2 and data on that column is not null. So, what should we do? We should add column on table with CLOB type. Please look at below example:

create table anar.test
       log_id number,
       log_date date,
       log_text varchar2(4000)

Add new column to TST table.

SQL> alter table TST add log_text2 Clob;

Then update value of log_text to log_text2.

update TST set log_text2 = log_text;

Drop log_text column.

SQL> alter table TST drop column log_text;

Rename log_text2 to log_text.

SQL> alter table TST rename column log_text2 to log_text;






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: