dbTalk Databases Forums  

Concat a column?

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


Discuss Concat a column? in the comp.databases.oracle.misc forum.



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

Default Concat a column? - 09-14-2009 , 01:33 PM






Hi All, I'm looking to concatenate multiple values for a single column
and am wondering if this is possible.

select concat(a1), a2, a3, a4
from A
group by a2,a3,a4

The above will select multiple values of a1. These could range between
one value to 10 or 12.
I'd like to have them all concatenated, while retaining distinct
values of a2,a3 and a4.

Is this possible?

TIA,
Sashi

Reply With Quote
  #2  
Old   
Michel Cadot
 
Posts: n/a

Default Re: Concat a column? - 09-14-2009 , 01:51 PM






"Sashi" <smalladi (AT) gmail (DOT) com> a écrit dans le message de news: c18a563e-94cf-4f35-8c96-df4d40105802...oglegroups.com...
Quote:
Hi All, I'm looking to concatenate multiple values for a single column
and am wondering if this is possible.

select concat(a1), a2, a3, a4
from A
group by a2,a3,a4

The above will select multiple values of a1. These could range between
one value to 10 or 12.
I'd like to have them all concatenated, while retaining distinct
values of a2,a3 and a4.

Is this possible?

TIA,
Sashi
Search for stragg on AskTom site.

Regards
Michel

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

Default Re: Concat a column? - 09-15-2009 , 08:22 AM



On Sep 14, 2:51*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
Quote:
"Sashi" <small... (AT) gmail (DOT) com> a écrit dans le message de news: c18a563e-94cf-4f35-8c96-df4d40105... (AT) j19g2000vbp (DOT) googlegroups.com...
| Hi All, I'm looking to concatenate multiple values for a single column
| and am wondering if this is possible.
|
| select concat(a1), a2, a3, a4
| from A
| group by a2,a3,a4
|
| The above will select multiple values of a1. These could range between
| one value to 10 or 12.
| I'd like to have them all concatenated, while retaining distinct
| values of a2,a3 and a4.
|
| Is this possible?
|
| TIA,
| Sashi

Search for stragg on AskTom site.

Regards
Michel
Thanks, Michel.
I've discovered that 10g offers a new function called collect which
seems to work similar to the stragg. Here' the link:
http://www.oracle-developer.net/display.php?id=306

Regards,
Sashi

Reply With Quote
  #4  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Concat a column? - 09-15-2009 , 09:22 AM



On Sep 15, 9:22*am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
On Sep 14, 2:51*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:





"Sashi" <small... (AT) gmail (DOT) com> a écrit dans le message de news: c18a563e-94cf-4f35-8c96-df4d40105... (AT) j19g2000vbp (DOT) googlegroups.com...
| Hi All, I'm looking to concatenate multiple values for a single column
| and am wondering if this is possible.
|
| select concat(a1), a2, a3, a4
| from A
| group by a2,a3,a4
|
| The above will select multiple values of a1. These could range between
| one value to 10 or 12.
| I'd like to have them all concatenated, while retaining distinct
| values of a2,a3 and a4.
|
| Is this possible?
|
| TIA,
| Sashi

Search for stragg on AskTom site.

Regards
Michel

Thanks, Michel.
I've discovered that 10g offers a new function called collect which
seems to work similar to the stragg. Here' the link:http://www.oracle-developer.net/display.php?id=306

Regards,
Sashi- Hide quoted text -

- Show quoted text -
Interesting new function. I will have to check it out especially to
see if under 10.2 where it creates the type under the executing user
instead of user sys to see if the feature works when the user does not
have create type privilege.

You can also solve this problem for character columns using a select
that concatenates the columns returned by a series of analytic inline
views outer joined together where each view provides the rows for one
position of the result per partition key. That is view1 returns
column1, view2 return column2, etc ... The row_number function can
be used to order the data by key marking which row is col1, col2,
col3, etc.... The concatenation puts all the columns into one result
set column. You could then join this back to the base table to pick
up other columns of interest.

HTH -- Mark D Powell --

Reply With Quote
  #5  
Old   
Michel Cadot
 
Posts: n/a

Default Re: Concat a column? - 09-15-2009 , 11:57 AM



"Sashi" <smalladi (AT) gmail (DOT) com> a écrit dans le message de news: f5e766dc-f080-46b6-aa2c-5c7d9336b707...oglegroups.com...
On Sep 14, 2:51 pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
Quote:
"Sashi" <small... (AT) gmail (DOT) com> a écrit dans le message de news: c18a563e-94cf-4f35-8c96-df4d40105... (AT) j19g2000vbp (DOT) googlegroups.com...
| Hi All, I'm looking to concatenate multiple values for a single column
| and am wondering if this is possible.
|
| select concat(a1), a2, a3, a4
| from A
| group by a2,a3,a4
|
| The above will select multiple values of a1. These could range between
| one value to 10 or 12.
| I'd like to have them all concatenated, while retaining distinct
| values of a2,a3 and a4.
|
| Is this possible?
|
| TIA,
| Sashi

Search for stragg on AskTom site.

Regards
Michel
Thanks, Michel.
I've discovered that 10g offers a new function called collect which
seems to work similar to the stragg. Here' the link:
http://www.oracle-developer.net/display.php?id=306

Regards,
Sashi

-----------------------------------------------

It does not concatenate the values, it returns a collection of values.
SQL*Plus displays it as it seems the concatenation of the values but it is not.
If it makes what you want, good, but it is not what you asked.

Regards
Michel

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

Default Re: Concat a column? - 09-15-2009 , 05:26 PM



On Sep 15, 12:57*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
Quote:
It does not concatenate the values, it returns a collection of values.
SQL*Plus displays it as it seems the concatenation of the values but it is not.
If it makes what you want, good, but it is not what you asked.

Regards
Michel
You're right. It's a collection and no a concatenation. However, it
suits my needs for now and is good enough.
Thanks,
Sashi

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.