Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Formatting SQLplus output
On Tue, 21 Jul 1998 16:36:33 GMT, nasof_at_hotmail.com wrote:
>> How can I format sql query output so that a certain column is not printed
>> repeatedly?
>> I used Break On <column name>, but it didn't work when I concatenate my
>> column with | (pipe). I need to concatenate the columns because I want to
>> dump the output to a flat file, then email the flatfile as attachment.
>> I would appreciate any idea on how to do this.
>>
>> Eg. query:
>> Select employee# || '|' || order# || '|' || product# || '|'
>> from table1
>>
>> sample output:
>> E1 | Ord1 | Prod1
>> E1 | Ord1 | Prod2
>> E1 | Ord1 | Prod3
>>
>> desired output (same order numbers only printed once)
>> E1 | Ord1 | Prod1
>> E1 | | Prod2
>> E1 | | Prod3
>>
>> Thanks,
There is an option on the SET command which allows you to change the column separator from ' ' (space) to any character you want. Simply issue the following statement:
SET COLSEP '|' Continue using the BREAK on the column and you should get what you want.
Hope this helps,
Nuno Guerreiro Received on Tue Jul 21 1998 - 12:19:23 CDT
![]() |
![]() |