如何將varchar2修改為clob型別欄位(使用long過渡)

tolywang發表於2007-11-20

直接從varchar2 修改為clob會報錯,不讓修改,可以先修改為Long型別,然後從Long修改為clob .

而且更改為long,必須是 ORA-01439: 要修改的資料欄必須是空的, 才可以變更資料庫


Using ALTER TABLE to Convert LONG Columns to LOB Columns

You can use the ALTER TABLE statement in SQL to convert a LONG column to a LOB column. To do so, use the following syntax:

ALTER TABLE [.]
   MODIFY ( <long_column_name> { CLOB | BLOB | NCLOB } 
  [DEFAULT >]) [LOB_storage_clause];

For example, if you had a table that was created as follows:

CREATE TABLE Long_tab (id NUMBER, long_col LONG);

then you can change the column long_col in table Long_tab to datatype CLOB using following ALTER TABLE statement:

ALTER TABLE Long_tab MODIFY ( long_col CLOB );

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-85019/,如需轉載,請註明出處,否則將追究法律責任。

相關文章