Oracle: Changing VARCHAR2 column to CLOB

前端 未结 3 1562
南笙
南笙 2021-02-01 02:33

I have an encountered an issue where the data I was trying to store in my varchar2(4000) column was too big, so I wish to change the column to one more suitable for storing larg

3条回答
  •  無奈伤痛
    2021-02-01 02:59

    The most straightforward way, given that the operation of moving from a varchar column to a CLOB is disallowed, would be to create a new column and move the data from the old column to the new column:

    ALTER TABLE some_table ADD (foo CLOB);
    UPDATE some_table SET foo = old_column;
    ALTER TABLE some_table DROP COLUMN old_column;
    ALTER TABLE some_table RENAME COLUMN foo TO old_column;
    

提交回复
热议问题