Experience Directory in Software

Java,J2EE,Oracle,Linux experience and workaround tips. If you have thought at least once like "How much should I learn technologies to be good enough developer?", Yes answer is here, just read this articles.All articles are made use at real project and making clients happy!

Tuesday, August 12, 2008

Create TSV file with Spool feature of SQL Plus


To create TSV file of which Oracle DB record data,there is well known way to do so.

SQL>sqlplus -s ${YOUR CONNECTION NAME}

set linesize 500
set trimspool on
set verify off
set termout off
set echo off
set feedback off
set heading off
set pagesize 0

DEFINE DELIMITER='${TAB_SPACE}'
spool tsvfile.tsv
SELECT
COLUMN_A'&&DELIMITER'COLUMN_B'&&DELIMITER'COLUMN_C
FROM TABLE_A;
spool off;
exit;


that's all.
you will see all record data populated from TABLE_A are separated with Tab Space in tsvfile.tsv.

No comments:

The On Demand Global Workforce - oDesk