dbTalk Databases Forums  

Concatenate columns

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Concatenate columns in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sashi
 
Posts: n/a

Default Concatenate columns - 10-18-2007 , 03:02 PM






Hi all,

Is it possible to concatenate the columns of the results of a query
without having to run it through an external filter?

For examples, if I have
select col-A, col-B, col-C, col-D from my_table.

Can I write the query such that col-A, col-B and col-C come out
concatenated? Yes, they're the same data type.

So I'm looking for something like
select col-A + col-B + col-C, col-D where "+" is a concatenation
operator.

Thanks a lot!
Sashi


Reply With Quote
  #2  
Old   
Terry Dykstra
 
Posts: n/a

Default Re: Concatenate columns - 10-18-2007 , 03:26 PM






"Sashi" <smalladi (AT) gmail (DOT) com> wrote

Quote:
Hi all,

Is it possible to concatenate the columns of the results of a query
without having to run it through an external filter?

For examples, if I have
select col-A, col-B, col-C, col-D from my_table.

Can I write the query such that col-A, col-B and col-C come out
concatenated? Yes, they're the same data type.

So I'm looking for something like
select col-A + col-B + col-C, col-D where "+" is a concatenation
operator.

Thanks a lot!
Sashi

select col-A || col-B || col-C, col-D

--
Terry Dykstra




Reply With Quote
  #3  
Old   
Sashi
 
Posts: n/a

Default Re: Concatenate columns - 10-18-2007 , 03:32 PM



On Oct 18, 4:02 pm, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
Hi all,

Is it possible to concatenate the columns of the results of a query
without having to run it through an external filter?

For examples, if I have
select col-A, col-B, col-C, col-D from my_table.

Can I write the query such that col-A, col-B and col-C come out
concatenated? Yes, they're the same data type.

So I'm looking for something like
select col-A + col-B + col-C, col-D where "+" is a concatenation
operator.

Thanks a lot!
Sashi
To answer my own question, I figured out that I can use the "||"
operator or the concat function.



Reply With Quote
  #4  
Old   
Sashi
 
Posts: n/a

Default Re: Concatenate columns - 10-18-2007 , 09:16 PM



On Oct 18, 4:02 pm, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
Hi all,

Is it possible to concatenate the columns of the results of a query
without having to run it through an external filter?

For examples, if I have
select col-A, col-B, col-C, col-D from my_table.

Can I write the query such that col-A, col-B and col-C come out
concatenated? Yes, they're the same data type.

So I'm looking for something like
select col-A + col-B + col-C, col-D where "+" is a concatenation
operator.

Thanks a lot!
Sashi
To answer my own question, I figured out that I can use the "||"
operator or the concat function.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.