Re: This is a question about the concatenation symbol "||"

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Sat, 03 Jul 2004 13:35:27 -0700
Message-ID: <1088886960.723468_at_yasure>


Ole Hansen wrote:

> Hi,
>
>
> This is a question about the concatenation symbol "||"
>
> If i write this statement: "select
> empno||','||ename||','||job||','||hiredate from emp;"
>
> I get this output:
>
> 7369,SMITH,CLERK,17-DEC-80
> 7499,ALLEN,SALESMAN,20-FEB-81
> 7521,WARD,SALESMAN,22-FEB-81
> 7566,JONES,MANAGER,02-APR-81
> 7654,MARTIN,SALESMAN,28-SEP-81
>
>
> If i write this statement: "select *|| from emp;"
>
> I get an error.
>
>
> The reasen why a want to write "select *||" is, that I have a table
> with more than 200 fields, and I need to export them all to a
> csv-file. I don't want to write "field1||','||field2||',' ..." for all
> 200 fields.
>
> Is there a smart way to do this ???
>
> I use SQLPlus on Oracle 9i.
>
>
> Regards,
> Ole

If you really want to be smart take that 200+ column table and apply the rules of normalization to it. There is no excuse for a 200+ column table.

That said there is no way to do what you want other than to do it column by column. Exactly how were you planning to handle numbers and dates if you didn't?

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Sat Jul 03 2004 - 22:35:27 CEST

Original text of this message