Re: How to concatenate two lines of result from sqlplus

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 6 Nov 2006 11:48:01 +0100
Message-ID: <454f12e1$0$20001$426a74cc_at_news.free.fr>


"lovecreatesbea..._at_gmail.com" <lovecreatesbeauty_at_gmail.com> a écrit dans le message de news: 1162805420.949354.197710_at_k70g2000cwa.googlegroups.com... Michel Cadot wrote:
> "lovecreatesbea..._at_gmail.com" <lovecreatesbeauty_at_gmail.com> a écrit dans le message de news:
> 1162794135.333120.32910_at_b28g2000cwb.googlegroups.com...
> | Suppose I have a table named USER as below,
> |
> | TABLE: USER
> |
> | USER_NAME NUMBER ADDRESS
> | =============================================
> | dennis ritchie 123456 att bell lab
> | ken thomas 234567 att bell lab
> |
> | I select the content in korn shell as following:
> |
> | #...
> |
> | sqlplus -silent ""$user"/"$pass"_at_"$db_ins"" <<-EOF
> | set feed off
> | set heading off
> | spool $output # variables assigned somewhere already
> |
> | select USER_NAME, NUMBER, ADDRESS
> | from USER
> |
> | spool off
> | exit
> | EOF
> |
> | #...
> |
> | My question is, I get the result in the $output file as,
> |
> | dennis ritchie
> |
> | 123456 att bell lab
> |
> | How can I concatenate two lines above? Or how can I place the line
> | 123456 att bell lab after dennis ritchie?
> |
>
> Format your columns (statement "column")
> Set your linesize to a big value (statement "set linesize")
> Trim your output (statements "set trimout on", "set trimspool on")

Thank you, Michel.

I just tried your method, I used these options:

#...
column username format 99999



"format 99999" is not a correct character format

set linesize 80



"80" is not big use "200" or more for instance (depending on your column format)

set trimout on
set trimspool on
#...

Perhaps I did not write these command correctly, it did not take effect.

I've useed the || operators to solve the problems

#...
select username || ' ' || number || ' ' || address #...

but I don't know whether this work in the most cases.

[Quoted] I also want to ask for your help on another question. I have set

set feed off
set echo off

but I still get the result of the select statement on the UNIX command terminal. What was I missing?



use "set termout off" to eliminate output on your terminal.

Regards
Michel Cadot Received on Mon Nov 06 2006 - 11:48:01 CET

Original text of this message