Question

How to aggregate string( concatenate) with Oracle 10g SQL?

Was it helpful?

Solution

You could try the collect function:

http://www.oracle-developer.net/display.php?id=306

Some other tricks are here:

http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

...If you actually mean concatenation instead of aggregation then take everyone else's advice and use the || operator between the two strings:

select 'abc'||'def' from dual;

OTHER TIPS

Oddly enough, it's the "||" operator:

field1 || field2

You could use the || operator. Ex: 'First' || 'Second'

Also the function CONCAT(var1, var2) allows you to concatenate two VARCHAR2 characters. Ex: CONCAT('First', 'Second')

Concatenate: CONCAT or ||

Aggregate: COLLECT

There is an undocumented function wm_concat that you can use. Another option would be to roll your own. LISTAGG isn't available in 10g, I think.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top