how to put | in the file output of the spool

August 18, 2011 at 14:32:37
Specs: oracle
How can we save (spool) the output of an SQL query to an external file(.txt) with some specific delimiter for example |

See More: how to put | in the file output of the spool

Report •

#1
August 18, 2011 at 22:14:08
Set the following code into a shell scipt - call it script.ss:

$ORACLE_HOME/bin/sqlplus -S "$LOGIN/$PW" << EOF
SET HEADING OFF
SET MARKUP HTML OFF
SET echo off
SET SERVEROUTPUT OFF
SET FEEDBACK OFF

select joid||'|'||job_name||'|'|| job_type from job;

This example is looking at 3 columns in the table called job. This ||'|'|| places a pipe symbol between the columns. You could use the Oracle spool command to send the output to a file or redirect the output to a file:

script.ss > datafile.txt

EOF


Report •
Related Solutions


Ask Question