Re: Specifying Column Separators

From: Oracle Admin <oracle_at_Dino.comm.mot.com>
Date: Sat, 3 Apr 1993 10:07:10 GMT
Message-ID: <1993Apr3.100710.15903_at_schbbs.mot.com>


In article <1993Apr2.153710.9264_at_cbfsb.cb.att.com> gerette_at_cbnewsb.cb.att.com (m arianne.g.pittorino) writes:
>Good Day, Good People:
>Does anyone know how to specify a column separator value (e.g., pipe or comma
>or colon) in SQL*Plus? For example, if my table is:
>
> MYTABLE
> -------
> COL_A char(6)
> COL_B number(5)
>
>and I have a little shell script (UNIX) that selects all rows in MYTABLE, I
>want the output to look like:
>
> first|100
> second|200
> thrid|300
>
>I know that there is a record separator option; is there a "set" option for
>column separation? I am using SQL*Plus 3.0.12.4.1.
>
>
>Thanks,
>Marianne G. Pittorino

   The solution is to concatenate the rows together with whatever separator you choose. For example:

         SELECT col_a || '|' || col_b
         FROM   table;

   This will get the kind of output you want.


J. Troy Tinnes                                (    )    Speaking of MUS to
System Programmer/Analyst                ___    /|    integrate C programs into
Osaka Cellular Support Center           /-  \__/ |    PERL:
Nippon Motorola Ltd                    /         |    "It's not 100% effective
Osaka Japan                            \ _/   /\ |     but it beats a kick in
tinnes_at_ocsc.nml.gss.mot.com             \____/  \|     the head" - Larry Wall
-------------------------------------------------------------------------------
Received on Sat Apr 03 1993 - 12:07:10 CEST

Original text of this message