I am having ORACLE 11 version installed on my linux machine. I am trying to export data using below. It is working fine for all the tables except for tables having double quotes(") as data in any of column. Below is my code
set echo off
set feedback off
set linesize 30000
set recsep off
set trimspool off
set verify off
set pagesize off
spool "/home/rsau12/file.csv";
SELECT '"'||COLUMN_1||'"'||','
'"'||COLUMN_2||'"'||','
'"'||COLUMN_3||'"'||','
...
'"'||COLUMN_N||'"'
FROM TABLE;
spool off;
Please let me know how to handle if data has (") in it
set markup csvcommand, which greatly simplifies exports. (Btw, in addition to double quotes, you also have to worry about commas. Many of the "simple" solution for CSV files ignore most of the CSV features.)