How to change column varchar to clob in oracle

Whtisop picture Whtisop · Jul 27, 2011 · Viewed 52.9k times · Source

I have a column details designed as varchar in oracle DB, this DB is being used now for customers and some rows already have data stored.

Now I want to change the column details to a Clob column. What is a smart way to accomplish this?

Answer

Kevin Burton picture Kevin Burton · Jul 27, 2011

(as the previous answer) and here's the code:

ALTER TABLE atable
 ADD (tmpdetails  CLOB);

UPDATE atable SET tmpdetails=details;
COMMIT;

ALTER TABLE atable DROP COLUMN details;

ALTER TABLE atable
RENAME COLUMN tmpdetails TO details;