Archive for April 5th, 2009
GROUP_CONCAT in Oracle 10g
MySQL has a nice aggregate function called GROUP_CONCAT
, which concatenates all strings in a group in given order, separating them with a given separator.
In one of the previous articles, I wrote about emulating this function in PostgreSQL.
Now, we'll try to emulate this function in Oracle 10g.
There are numerous solutions using Oracle's hierarchical function SYS_CONNECT_BY_PATH
, but they're bad in the following ways:
- Not all queries can be rewritten using
CONNECT BY
- Even if they can,
CONNECT BY
performs poorly on some conditions
Instead, we will emulate this function using Oracle's MODEL
clause.
Read the rest of this entry »