How to export clob field datas in oracle sql developer

前端 未结 4 1743
耶瑟儿~
耶瑟儿~ 2020-12-15 06:04

How to export clob field data\'s in oracle sql developer. Currently clob field data\'s can\'t export in oracle sql developer.

4条回答
  •  我在风中等你
    2020-12-15 06:45

    If you don't want to (or can't) export and import your data, and really want it as a set of insert statements, you can use SQL Developer's built-in formatting tools to automatically split your CLOBs into multiple chunks that are small enough to be valid as string literals, and then spool the result to a file:

    spool clob_export.sql
    select /*insert*/ * from your_table;
    spool off
    

    With more recent versions you can use the sqlformat command to control the output format without needing to modify the query; this is equivalent:

    set sqlformat insert
    spool clob_export.sql
    select * from your_table;
    spool off
    

    The generated insert statements will look something like:

    REM INSERTING into YOUR_TABLE
    SET DEFINE OFF;
    Insert into YOUR_TABLE (ID,CLOB_COLUMN) values (1,TO_CLOB('... up to 4k of characters with quotes escaped ...')
    || TO_CLOB('... up to 4k of characters with quotes escaped ...')
    || TO_CLOB('... up to 4k of characters with quotes escaped ...')
    ...
    || TO_CLOB('... up to 4k of characters with quotes escaped ...'));
    

提交回复
热议问题