Hi!
My goal is to extract data in a CSV-format. I do it like this:
set term off
set trimspool on
set head off
set feed off
spool output.csv
select level || ';some_val;'||to_char(sysdate, 'DD.MM.YYYY') line
from dual
connect by level <= 5;
spool off
exit
Everything is cool but SQL Plus sets CRLF as a line separator (as I'm on Windows). But my exported file will be handled later in *nix.
So the question is how can one set new line character in SQL Plus? Is it possible?
If not then how can I achieve this?
I don't think sqlplus has a native way of doing this.
Once you have spooled your file, you can use utilities such as dos2unix or unix2dos to adjust the line feeds for your target environment. These are typically natively available on unix, and its easy to find Windows versions of these as well.