Forum Stats

  • 3,781,112 Users
  • 2,254,481 Discussions
  • 7,879,573 Comments

Discussions

SQLcl Issue with csv export import

jpbenezet
jpbenezet Member Posts: 10 Blue Ribbon
edited May 3, 2019 3:23PM in SQLcl

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

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

Tagged:

Answers