How to change a dataype CLOB TO VARCHAR2(sql)

前端 未结 1 374
离开以前
离开以前 2021-01-11 17:47

Table: customers

ID      NAME             DATATYPE
NUMBER  VARCHAR2(100)    CLOB

I want to change the DATA column from C

1条回答
  •  不思量自难忘°
    2021-01-11 17:51

    You may try this:

    1. Add a new column as varchar2

      alter table my_table add (new_column varchar2(1000));

    2. UPDATE CLOB name to varchar2 column;

      update my_table set new_column=dbms_lob.substr(old_column,1000,1);

    After testing your data:

    1. DROP CLOB column

      alter table my_table drop column old_column

    2. Rename varchar2 column to CLOB column name

      alter table my_table rename column new_column to old_column

    0 讨论(0)
提交回复
热议问题