3 Replies Latest reply on May 3, 2019 7:23 PM by Glen Conway

    SQLcl Issue with csv export import

    jpbenezet

      I have an issue with SQLCL and data export / import .

       

       

      I try to export data with spool and select /*sql*/ and import with load but the imported data are not the same than the exported one

       

       

      CREATE TABLE DATA

      (

        key VARCHAR2(10 CHAR),

        val VARCHAR2(500 CHAR)

      );

       

      REM INSERTING into DATA

      SET DEFINE OFF;

      Insert into DATA (KEY,VAL) values ('01','00');

      Insert into DATA (KEY,VAL) values ('02','"');

      Insert into DATA (KEY,VAL) values ('03','""');

      Insert into DATA (KEY,VAL) values ('04','''');

      Insert into DATA (KEY,VAL) values ('05','''''');

      Insert into DATA (KEY,VAL) values ('06','test "a" val ''b'';');

      Insert into DATA (KEY,VAL) values ('07','$');

      Insert into DATA (KEY,VAL) values ('08','\"');

      Insert into DATA (KEY,VAL) values ('09','\''');

       

       

      spool export_DATA_01.csv

      select /*csv*/ * from DATA;

      spool off

       

       

      spool export_DATA_01.sql

      select /*insert*/ * from DATA;

      spool off

       

      truncate table DATA;

      load DATA export_DATA_01.csv

       

      spool export_DATA_02.csv

      select /*csv*/ * from DATA;

      spool off

       

      spool export_DATA_02.sql

      select /*insert*/ * from DATA;

      spool off

       

      compare export_DATA_01.csv and export_DATA_02.csv