Re: Creating a delimited text file with SQL*Plus / PL/SQL

From: Christopher Jones <cjones_at_au.oracle.com>
Date: 1996/03/24
Message-ID: <x77mwbfjrj.fsf_at_hurrah.au.oracle.com>#1/1


In article <31543774.5479_at_ix.netcom.com> Ter Bear <t_porter_at_ix.netcom.com> writes:

> I already have to massage the data from PL/SQL to solve other problems,
> so I don't want to bore you with that. After I finish that, the table
> will be ready to export in its entirety. All I need is all fields, one
> row per line, each field separated by a | (or comma, or whatever).

SQL*Plus 3.2 introduced a SET COLSEP command you may find useful e.g.

    SQL> set colsep ' | '
    SQL> select * from dept;

        DEPTNO | DNAME | LOC

  • | -------------- | ------------- 10 | ACCOUNTING | NEW YORK 20 | RESEARCH | DALLAS 30 | SALES | CHICAGO 40 | OPERATIONS | BOSTON
Alternatively try the age old solution of:

    SQL> select deptno || ' | ' || dname || ' | ' || loc from dept;

    DEPTNO||'|'||DNAME||'|'||LOC


    10 | ACCOUNTING | NEW YORK
    20 | RESEARCH | DALLAS
    30 | SALES | CHICAGO
    40 | OPERATIONS | BOSTON


Chris

-- 


Christopher Jones, cjones_at_au.oracle.com

The opinions expressed here are my own, and are not necessarily 
those of Oracle Corporation
Received on Sun Mar 24 1996 - 00:00:00 CET

Original text of this message