String concatenation in group by?

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi,

I'm wondering if its possible to perform concatenation of strings in
"group by".  I'm still using Oracle 9.2, so I cannot take advantage
10g's new "collect" aggregrate function.

Here is an example table, tab_example:

ID    Name
---    -----------
1     Hello
1     World

My desired query result:
ID    Concatenated_Name
---    ------------------------------
1     Hello World


Thanks a lot.

0
Reply gordon.t.wu (8) 5/1/2007 2:16:23 PM

See related articles to this posting


"Tao" <gordon.t.wu@gmail.com> a �crit dans le message de news: 1178028983.392635.62470@n59g2000hsh.googlegroups.com...
| Hi,
|
| I'm wondering if its possible to perform concatenation of strings in
| "group by".  I'm still using Oracle 9.2, so I cannot take advantage
| 10g's new "collect" aggregrate function.
|
| Here is an example table, tab_example:
|
| ID    Name
| ---    -----------
| 1     Hello
| 1     World
|
| My desired query result:
| ID    Concatenated_Name
| ---    ------------------------------
| 1     Hello World
|
|
| Thanks a lot.
|

I wonder why people always think they are the first one to ask for a question. <g>

I just put "oracle string aggregation" in Google and the first item returned
 (http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php)
gives 5 ways to do it.

Regards
Micel Cadot 


0
Reply Michel 5/1/2007 2:57:01 PM

Micel,

I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
"collect" function is of no use to me.
Yes I understand any string manipulation can be done using PL/SQL
functions, thanks.

On May 1, 10:57 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 11780289=
83.392635.62...@n59g2000hsh.googlegroups.com...
> | Hi,
> |
> | I'm wondering if its possible to perform concatenation of strings in
> | "group by".  I'm still using Oracle 9.2, so I cannot take advantage
> | 10g's new "collect" aggregrate function.
> |
> | Here is an example table, tab_example:
> |
> | ID    Name
> | ---    -----------
> | 1     Hello
> | 1     World
> |
> | My desired query result:
> | ID    Concatenated_Name
> | ---    ------------------------------
> | 1     Hello World
> |
> |
> | Thanks a lot.
> |
>
> I wonder why people always think they are the first one to ask for a ques=
tion. <g>
>
> I just put "oracle string aggregation" in Google and the first item retur=
ned
>  (http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php)
> gives 5 ways to do it.
>
> Regards
> Micel Cadot


0
Reply gordon.t.wu (8) 5/1/2007 3:01:58 PM

"Tao" <gordon.t.wu@gmail.com> a �crit dans le message de news: 1178031718.880006.168270@h2g2000hsg.googlegroups.com...
Micel,

I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
"collect" function is of no use to me.
Yes I understand any string manipulation can be done using PL/SQL
functions, thanks.

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

"collect" is just the last explained way, there 4 others available in 9.2
and one does not use PL/SQL.

Regards
Michel Cadot


0
Reply Michel 5/1/2007 3:10:26 PM

Sorry mother.
So out of 5 ways, the 4th one might apply in my case.  What makes you
think I have no right to ask for ppl's opinion if there is a easier
way that I didn't see?  That offended you so much didn't it.

On May 1, 11:10 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 11780317=
18.880006.168...@h2g2000hsg.googlegroups.com...
> Micel,
>
> I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
> "collect" function is of no use to me.
> Yes I understand any string manipulation can be done using PL/SQL
> functions, thanks.
>
> ---------------------------------
>
> "collect" is just the last explained way, there 4 others available in 9.2
> and one does not use PL/SQL.
>
> Regards
> Michel Cadot


0
Reply gordon.t.wu (8) 5/1/2007 3:28:32 PM

Comments embedded.
On May 1, 10:01 am, Tao <gordon.t...@gmail.com> wrote:
> Micel,
>
> I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
> "collect" function is of no use to me.

So be intelligent enough to not consider that 'option' and proceed on
to the other four.

> Yes I understand any string manipulation can be done using PL/SQL
> functions, thanks.
>

And, yet, there is a non-PL/SQL option available you apparently choose
to overlook.  Instead of disparaging suggestions made to you why not
accept them graciously and evaluate them on their merits?

> On May 1, 10:57 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
>
>
>
> > "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 117802=
8983.392635.62...@n59g2000hsh.googlegroups.com...
> > | Hi,
> > |
> > | I'm wondering if its possible to perform concatenation of strings in
> > | "group by".  I'm still using Oracle 9.2, so I cannot take advantage
> > | 10g's new "collect" aggregrate function.
> > |
> > | Here is an example table, tab_example:
> > |
> > | ID    Name
> > | ---    -----------
> > | 1     Hello
> > | 1     World
> > |
> > | My desired query result:
> > | ID    Concatenated_Name
> > | ---    ------------------------------
> > | 1     Hello World
> > |
> > |
> > | Thanks a lot.
> > |
>
> > I wonder why people always think they are the first one to ask for a qu=
estion. <g>
>
> > I just put "oracle string aggregation" in Google and the first item ret=
urned
> >  (http://www.oracle-base.com/articles/10g/StringAggregationTechniques.p=
hp)
> > gives 5 ways to do it.
>
> > Regards
> > Micel Cadot- Hide quoted text -
>
> - Show quoted text -


David Fitzjarrell

0
Reply fitzjarrell (2005) 5/1/2007 3:57:40 PM

On May 1, 10:28 am, Tao <gordon.t...@gmail.com> wrote:
> Sorry mother.
> So out of 5 ways, the 4th one might apply in my case.  What makes you
> think I have no right to ask for ppl's opinion if there is a easier
> way that I didn't see?  That offended you so much didn't it.
>
> On May 1, 11:10 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
>
>
>
> > "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 117803=
1718.880006.168...@h2g2000hsg.googlegroups.com...
> > Micel,
>
> > I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
> > "collect" function is of no use to me.
> > Yes I understand any string manipulation can be done using PL/SQL
> > functions, thanks.
>
> > ---------------------------------
>
> > "collect" is just the last explained way, there 4 others available in 9=
..2
> > and one does not use PL/SQL.
>
> > Regards
> > Michel Cadot- Hide quoted text -
>
> - Show quoted text -

What makes you think Michel, or anyone here, thinks that?  Are your
sensibilities so fragile that any comment, no matter the nature, is an
attack on you?  The response you received from Michel provided the
requested  information, and did so with a bit of humour.  It is a
shame  you can't recognize good natured wordplay when it is  presented
to you.


David Fitzjarrell

0
Reply fitzjarrell (2005) 5/1/2007 4:01:02 PM

On May 1, 3:16 pm, Tao <gordon.t...@gmail.com> wrote:
> Hi,
>
> I'm wondering if its possible to perform concatenation of strings in
> "group by".  I'm still using Oracle 9.2, so I cannot take advantage
> 10g's new "collect" aggregrate function.
>
> Here is an example table, tab_example:
>
> ID    Name
> ---    -----------
> 1     Hello
> 1     World
>
> My desired query result:
> ID    Concatenated_Name
> ---    ------------------------------
> 1     Hello World
>
> Thanks a lot.

http://www.williamrobertson.net/documents/one_row.html

0
Reply williamr2019 (119) 5/2/2007 9:02:02 AM

On May 1, 12:01 pm, "fitzjarr...@cox.net" <fitzjarr...@cox.net> wrote:
> On May 1, 10:28 am, Tao <gordon.t...@gmail.com> wrote:
>
>
>
> > Sorry mother.
> > So out of 5 ways, the 4th one might apply in my case.  What makes you
> > think I have no right to ask for ppl's opinion if there is a easier
> > way that I didn't see?  That offended you so much didn't it.
>
> > On May 1, 11:10 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
>
> > > "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 1178=
031718.880006.168...@h2g2000hsg.googlegroups.com...
> > > Micel,
>
> > > I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
> > > "collect" function is of no use to me.
> > > Yes I understand any string manipulation can be done using PL/SQL
> > > functions, thanks.
>
> > > ---------------------------------
>
> > > "collect" is just the last explained way, there 4 others available in=
 9.2
> > > and one does not use PL/SQL.
>
> > > Regards
> > > Michel Cadot- Hide quoted text -
>
> > - Show quoted text -
>
> What makes you think Michel, or anyone here, thinks that?  Are your
> sensibilities so fragile that any comment, no matter the nature, is an
> attack on you?  The response you received from Michel provided the
> requested  information, and did so with a bit of humour.  It is a
> shame  you can't recognize good natured wordplay when it is  presented
> to you.
>
> David Fitzjarrell

Because the word he was using "is" harsh?
Maybe Tao over-looked an solution.  But what these forums are for?
That that gives Michel and you the right to bash him?

0
Reply gordon_t_wu (18) 5/3/2007 4:33:11 PM

On May 1, 10:57 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "Tao" <gordon.t...@gmail.com> a =E9crit dans le message de news: 11780289=
83.392635.62...@n59g2000hsh.googlegroups.com...
> | Hi,
> |
> | I'm wondering if its possible to perform concatenation of strings in
> | "group by".  I'm still using Oracle 9.2, so I cannot take advantage
> | 10g's new "collect"aggregratefunction.
> |
> | Here is an example table, tab_example:
> |
> | ID    Name
> | ---    -----------
> | 1     Hello
> | 1     World
> |
> | My desired query result:
> | ID    Concatenated_Name
> | ---    ------------------------------
> | 1     Hello World
> |
> |
> | Thanks a lot.
> |
>
> I wonder why people always think they are the first one to ask for a ques=
tion. <g>
>
> I just put "oracle string aggregation" in Google and the first item retur=
ned
>  (http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php)
> gives 5 ways to do it.
>
> Regards
> Micel Cadot

Well when you already know the solution, its easy to find it.  For
people who do not already know, its not so easy for them to put the
right key words in google.  Apparently he did search for solutions
before coming here, which is exactly what this group is for.  No
reason to insult people while providing an answer.

0
Reply gordon_t_wu (18) 5/3/2007 4:37:16 PM

<gordon_t_wu@hotmail.com> a �crit dans le message de news: 1178210236.450528.155040@p77g2000hsh.googlegroups.com...
On May 1, 10:57 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "Tao" <gordon.t...@gmail.com> a �crit dans le message de news: 1178028983.392635.62...@n59g2000hsh.googlegroups.com...
> | Hi,
> |
> | I'm wondering if its possible to perform concatenation of strings in
> | "group by".  I'm still using Oracle 9.2, so I cannot take advantage
> | 10g's new "collect"aggregratefunction.
> |
> | Here is an example table, tab_example:
> |
> | ID    Name
> | ---    -----------
> | 1     Hello
> | 1     World
> |
> | My desired query result:
> | ID    Concatenated_Name
> | ---    ------------------------------
> | 1     Hello World
> |
> |
> | Thanks a lot.
> |
>
> I wonder why people always think they are the first one to ask for a question. <g>
>
> I just put "oracle string aggregation" in Google and the first item returned
>  (http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php)
> gives 5 ways to do it.
>
> Regards
> Micel Cadot

Well when you already know the solution, its easy to find it.  For
people who do not already know, its not so easy for them to put the
right key words in google.  Apparently he did search for solutions
before coming here, which is exactly what this group is for.  No
reason to insult people while providing an answer.

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

I don't see any clue he searched hard as he only got a way.
I only used the words he used:
Oracle is this not Oracle he is working with
"string aggregation", well the subject is "string concatenation in group by"
so "group by" means aggregation, of what... of strings.
So it is clearly obvious to use "oracle string aggregation", or at least
to try it.

Btw, your and his email are the same ones, don't you are the same person?
Is it in your way to talk about you at the third person?

Regards
Michel Cadot


0
Reply Michel 5/3/2007 5:05:08 PM

<gordon_t_wu@hotmail.com> a �crit dans le message de news: 1178209991.303094.297830@y5g2000hsa.googlegroups.com...
On May 1, 12:01 pm, "fitzjarr...@cox.net" <fitzjarr...@cox.net> wrote:
> On May 1, 10:28 am, Tao <gordon.t...@gmail.com> wrote:
>
>
>
> > Sorry mother.
> > So out of 5 ways, the 4th one might apply in my case.  What makes you
> > think I have no right to ask for ppl's opinion if there is a easier
> > way that I didn't see?  That offended you so much didn't it.
>
> > On May 1, 11:10 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
>
> > > "Tao" <gordon.t...@gmail.com> a �crit dans le message de news: 1178031718.880006.168...@h2g2000hsg.googlegroups.com...
> > > Micel,
>
> > > I believe I've mentioned that I'm still using Oracle 9.2 so 10g's
> > > "collect" function is of no use to me.
> > > Yes I understand any string manipulation can be done using PL/SQL
> > > functions, thanks.
>
> > > ---------------------------------
>
> > > "collect" is just the last explained way, there 4 others available in 9.2
> > > and one does not use PL/SQL.
>
> > > Regards
> > > Michel Cadot- Hide quoted text -
>
> > - Show quoted text -
>
> What makes you think Michel, or anyone here, thinks that?  Are your
> sensibilities so fragile that any comment, no matter the nature, is an
> attack on you?  The response you received from Michel provided the
> requested  information, and did so with a bit of humour.  It is a
> shame  you can't recognize good natured wordplay when it is  presented
> to you.
>
> David Fitzjarrell

Because the word he was using "is" harsh?
Maybe Tao over-looked an solution.  But what these forums are for?
That that gives Michel and you the right to bash him?

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

How does it come that your's and Tao's email are the same ones?

Regards
Michel Cadot



0
Reply Michel 5/3/2007 5:06:48 PM
comp.databases.oracle.server 21290 articles. 10 followers. Post

11 Replies
183 Views

Similar Articles

[PageSpeed] 13


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

string concatenation via Group By
Is it possible to concatenate records in a field via Group By clause of an SQL statement? Untested script is : create table t1(country varchar2(32), state varchar2(32), city varchar2 (32)) ; insert into t1 values ('USA', 'CA', 'Sacramento') ; insert into t1 values ('USA', 'CA', 'San Jose') ; insert into t1 values ('USA', 'CA', 'three') ; insert into t1 values ('USA', 'CA', 'four') ; insert into t1 values ('USA', 'CA', 'Fremont') ; insert into t1 values ('Can...

concatenate strings/dates in groups
Hi Group, Anyone know how to concatenate all the distinct 'dates' in groups of id +sampleid to form the new variable "dates"? data test; input id sampleid date date9. ; cards; 1 1 30Sep2008 1 1 11Oct2008 1 1 13Oct2008 1 2 29Sep2008 1 2 09Oct2008 1 2 10Oct2008 ; The result I want is: id sampleid date dates 1 1 17805 17805,17816,17818 1 1 17816 17805,17816,17818 1 1 17818 17805,17816,17818 1 2 17804 17804,17814,17815 1 2 17814 17804,17814,17815 1 2 17815 17804,17814,17815 The...

Re: concatenate strings/dates in groups
data test; input id sampleid date date9. ; cards; 1 1 30Sep2008 1 1 11Oct2008 1 1 13Oct2008 1 2 29Sep2008 1 2 09Oct2008 1 2 10Oct2008 ; Run ; Data Need ( Drop = I K ) ; Length Dates $ 200 ; Do I = 1 By 1 Until( Last.SampleID ) ; Set Test ; By ID SampleID ; If ( Index( Put( Date , Date9. ) , Dates ) = 0 ) Then Dates = CatX( ',' , Dates , Put( Date , Date9. ) ) ; End ; Do K = 1 By 1 Until( Last.SampleID ) ; Set Test ; By ID SampleID ; Output ; End ; Run ; Proc Print Data = Need ; Run ; On Tue, 28 Oct 2008 08:18:27 -0700, haoyugu@GMAIL.COM wrote: >Hi Group, &...

Concatenating string fields with GROUP BY clause
This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C376CA.2909B800 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi -=20 I am trying to concatenate a text field in a query with a group by clause, = similar to a sum() function on a numeric value - for example: SELECT groupid, sum(numeric_field), ???(text_field) FROM table GROUP BY gro= upid but I cannot find a function that will concatenate the text fields. Any com= ments appreciated! TIA,BGH ------=_NextPart_000_0018_01C376CA.2909B800 Conten...

Re: concatenate strings/dates in groups #2
You could use a proc transpose: data test; input id sampleid date date9. ; cards; 1 1 30Sep2008 1 1 11Oct2008 1 1 13Oct2008 1 2 29Sep2008 1 2 09Oct2008 1 2 10Oct2008 ; run; proc transpose data=test out=test_trans; by id sampleid; var date; run; data want; merge test(in=a) test_trans(in=b); by id sampleid; drop _name_; rename col1=date1 col2=date2 col3=date3 ; run; -Joe On Tue, Oct 28, 2008 at 10:18 AM, <haoyugu@gmail.com> wrote: > Hi Group, > Anyone know how to concatenate all the distinct 'dates' in groups of id > +sampleid to form the new variable &q...

Re: concatenate strings/dates in groups #8
On Tue, 28 Oct 2008 08:18:27 -0700, haoyugu@GMAIL.COM wrote: >Hi Group, >Anyone know how to concatenate all the distinct 'dates' in groups of id >+sampleid to form the new variable "dates"? > >data test; > input id sampleid date date9. ; > cards; > 1 1 30Sep2008 > 1 1 11Oct2008 > 1 1 13Oct2008 > 1 2 29Sep2008 > 1 2 09Oct2008 > 1 2 10Oct2008 > ; > >The result I want is: > id sampleid date dates > 1 1 17805 17805,17816,17818 > 1 1 17816 17805,17816,17818 > 1 1 17818 178...

Re: concatenate strings/dates in groups #5
I was just playing around. You probably want to use Toby's HoWDy Do. But the missing option and the missing function can make this more general. See modified example below. data test; input id sampleid date:date9.; format date date9.; cards; 1 1 30Sep2008 1 1 11Oct2008 1 1 13Oct2008 1 2 29Sep2008 1 2 09Oct2008 1 2 10Oct2008 1 2 15Oct2008 ;;;; run; proc transpose out=test2(drop=_name_ where=(not missing(date))) prefix=date_; by id sampleid; var date date date date date date date; copy date; run; options missing=' '; data test2; set test2; le...

Re: concatenate strings/dates in groups #7
On Tue, 28 Oct 2008 11:48:09 -0400, Toby Dunn <tobydunn@HOTMAIL.COM> wrote: >Data _Null_, > >The only problem I have with the transpose method is that it will not >yeild distinct date values in the Dates variable. Which is what I believe >was originally asked for, unless I missunderstood the requestor. To do so >would require at the minimum a sort nodup key and then a transpose. Its >one extra pass of the data that isnt neccessary. > >On the other hand what was ask is a bad idea to begin with as non atomic >values are just a bad thingy all together. In a...

Re: concatenate strings/dates in groups #6
I knew that someone would post a solution using a HoWDy Do. I wasn't really interested in the problem or the solution. I was just fiddling with the the COPY statement. I find your use of irrelevant counters "I K" to be somewhat disquieting. On 10/28/08, Toby Dunn <tobydunn@hotmail.com> wrote: > Data _Null_, > > The only problem I have with the transpose method is that it will not > yeild distinct date values in the Dates variable. Which is what I believe > was originally asked for, unless I missunderstood the requestor. To do so > would require at the ...

Re: concatenate strings/dates in groups #4
Well maybe.... data test; input id sampleid date:date9.; format date date9.; cards; 1 1 30Sep2008 1 1 11Oct2008 1 1 13Oct2008 1 2 29Sep2008 1 2 09Oct2008 1 2 10Oct2008 ;;;; run; proc transpose out=test2(drop=_name_) prefix=date_; by id sampleid; var date date date; copy date; run; data test2; set test2; length dates $30; dates = catx(',', of date_:); run; Proc print; run; On 10/28/08, haoyugu@gmail.com <haoyugu@gmail.com> wrote: > Hi Group, > Anyone know how to concatenate all the distinct 'dates' in groups of id > +...

Re: concatenate strings/dates in groups #3
Data _Null_, The only problem I have with the transpose method is that it will not yeild distinct date values in the Dates variable. Which is what I believe was originally asked for, unless I missunderstood the requestor. To do so would require at the minimum a sort nodup key and then a transpose. Its one extra pass of the data that isnt neccessary. On the other hand what was ask is a bad idea to begin with as non atomic values are just a bad thingy all together. Toby Dunn On Tue, 28 Oct 2008 10:35:29 -0500, ./ ADD NAME=Data _null_, <iebupdte@GMAIL.COM> wrote: >Well maybe.... &...

Re: Concatenating string fields with GROUP BY clause
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C376F5.398309E0 Content-Type: text/plain; charset="iso-8859-1" Concatenate is done with || in postgresql -----Original Message----- From: Brian G. Huber [mailto:brianghuber@yahoo.com] Sent: Tuesday, September 09, 2003 12:02 PM To: pgsql-novice@postgresql.org Subject: [NOVICE] Concatenating string fields with GROUP BY clause Hi - I am trying to concatenate a text field in a query with a group by cl...

String and list of strings concatenation
A procedure with the following signature proc setMessage {msg args} should consider "msg" as a string and "args" as a list of strings with arbitrary content, including curly braces ({, }), newline sequences (\r, \n) and double quotes ("). The goal is to return a string consisting of lines of text which are separated by newline. e. g. setMessage a b c gives a b c setMessage a\nb b c gives a b b c setMessage a\nb gives a b I came up with the following solution: proc setMessage {msg args} { if {[llength $args]} { set all [join [eval list [list...

String concatenation vs. string formatting
Is it bad practice to use this > logger.error(self.preset_file + ' could not be stored - ' + > sys.exc_info()[1]) Instead of this? > logger.error('{file} could not be stored - > {error}'.format(file=self.preset_file, error=sys.exc_info()[1])) Other than the case where a variable isn't a string (format() converts variables to strings, automatically, right?) and when a variable is used a bunch of times, concatenation is fine, but somehow, it seems wrong. Sorry if this seems a bit silly, but I'm a novice when it comes to design. Plus, there's not really s...

concatenating strings & string literals
i tried to output these 2 to the std. output: const std::string hello = "Hello"; const std::string message = hello + ", world" + "!"; const std::string exclam = "!"; const std::string message2 = "hello" + " world" + exclam; the first one runs fine but 2nd does not as we can not combine 2 string literals. i know that the "+" operator is left-associative, hence: /hello + ", world" + "!"/ means /(hello + ",world") + "!"/ but what does /(hello + ", world")/ will pro...

Concatenating elements of a string into a new string
Hello Matlab Community, I have a string like so: 4 First Last College Name Female 36 5 I have a data file with a few hundred lines like this, and I have no difficulty reading the lines into Matlab. What I was hoping to get some advice on is how I can compress this string down to something like this: 4_College Name_Female_36 The columns are tab delimited. I have some knowledge of regular expressions, though I have only used them to pull entire lines, rather than just components of lines. Any suggestions would be greatly appreciated! In the mean-time I'l...

'SUM' strings to concatenated string
Hi i am looking for a way to concatenate all values of query (that returns one varchar-field with multiple rows) into one string: e.g: select username from table_users returns: Miller Smith Frankfurter Gonzales i want: Miller;Smith;Frankfurter;Gonzales How can i 'SUM' strings, btw we are using ora 8i. Thanks for time and help, Alex If you know how many entries you get you can pivot them using group by. After that you can concatenate the columns. Works like this select max(name1), max(name2), max([...]) ( select case w...

regexp to match a string out of particular group of strings
Hellu everybudy! I am trying to write a regexp to match two strings. string 1 and string 2 string 1 - entered by user from command line string 2 - string out of a file. the regexp should only match one string out of set of strings(BDS BGS BBS BTS) of the file nothing more. for ex: Group of strings to be matched = BDS BGS BBS BTS if the user enter "BDS" then regexp shoud match this out of text file. (of cowrse this string is precent in the file) but if user enters BDW, it shoud not match any string of the file, even if it is precent in the file. I hop i am cleer enuf. user enter...

Concatenating Strings
Does anyone know if there is a function or how to write one that concatenates a letter to a string a specific number of times? For instance, I have letter H in a variable called $letter I want to create a string that contains H a certain number of times that is stored in another variable called $repetition. So, when $repetition is 5 my string should be HHHHH I was trying to write a custom function that uses another custom function called VariableInitialize and trying to Loop adding H to that string, but VariableInitialize seems to work only with number and not characters. PS: VariableIniti...

string concatenation
I often find myself writing scripts like this to continudally add to the end of a string, then print the final result: {text = text $0}END{print text} If I had a similar problem involving adding numbers, I would write it as: {num += $0}END{print num} i.e. use the "+=" operator to indicate that $0 should be added to the variable on the left side of the operator rather than having to specify the variable twice. I'd like to be able to do something similar for strings, e.g.: {text += $0}END{print text} but this won't work since the "+=" will convert the str...

string concatenation
How can i make string concatenations resulting in a longer than 32 characters string?? character ft*(128) despite declaring the identifier as above over 32 bytes i cannot make a concatenation of over 32 bytes. I though about doing the following way: ft='xxxx'//'yyyyy...yy' ft=ft//'yyyyy' in this way there's no error returned but the second line has no effect on ft there's no info about that into the docs -- heavytull heavytull wrote: > How can i make string concatenations resulting in a longer than 32 characters > string?? &...

String Concatenation
Hi - My matfile executes perfectly, and the output variable, n is a number. How do I let Matlab display the string "Final answer is :" , followed by n (a number). That is, is it possible to concatenate "Final answer is:" with n (a number), instead of Matlab just printing n? I will appreciate your help. Thanks alan alan wrote: > > > Hi - > > My matfile executes perfectly, and the output variable, n is a > number. > > How do I let Matlab display the string > "Final answer is :" , followed by n (a number). > > That is, is it poss...

Concatenating strings
Hi all, Consider the following code: data foo; length x y $50; x = 'h'; x = x || 'e'; x = x || 'l'; x = x || 'l'; x = x || 'o'; y = 'o'; y = 'l' || y; y = 'l' || y; y = 'e' || y; y = 'h' || y; run; If I run this code (in SAS8), I get a dataset with one observation and two variables. x has the value 'h' and y has the value 'hello'. Can anyone explain why there is a discrepency, and how I can get x to have th...

Concatenating to a string
I was wondering if there was an in-place concatenation of a string. I really would rather not do: (demacro my-concat (string char) `(setf ,string (concatenate 'string ,string (string ,char)))) Is there a better way to accomplish what I want? Thanks! Jeff you should check out the string tutorial at cl-cookbook.sf.net. It explains exactly what you want. Lowell Jeff wrote: > I was wondering if there was an in-place concatenation of a string. I > really would rather not do: > > (demacro my-concat (string char) > `(setf ,string (concatenate 'string ,string (string ,c...