Home » SQL & PL/SQL » SQL & PL/SQL » IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL (merged 3)
IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL (merged 3) [message #312541] Wed, 09 April 2008 03:38 Go to next message
raoexotic
Messages: 6
Registered: April 2008
Location: HYDERABAD
Junior Member

is there any function like mysql group_concat function in oracle?
IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL (merged) [message #312542 is a reply to message #312541] Wed, 09 April 2008 03:41 Go to previous messageGo to next message
raoexotic
Messages: 6
Registered: April 2008
Location: HYDERABAD
Junior Member

IS THERE ANY FUNCTION IN ORACLE LIKE MYSQL FUNCTION GROUP_CONCAT, ANY SUGGESSIONS APPRICIATED.
icon4.gif  IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL [message #312543 is a reply to message #312542] Wed, 09 April 2008 03:42 Go to previous messageGo to next message
raoexotic
Messages: 6
Registered: April 2008
Location: HYDERABAD
Junior Member

IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL
Re: LIKE MYSQL FUNCTION GROUP_CONCAT IN ORACLE [message #312544 is a reply to message #312542] Wed, 09 April 2008 03:49 Go to previous messageGo to next message
MarcS
Messages: 312
Registered: March 2007
Location: Antwerp
Senior Member
raoexotic wrote on Wed, 09 April 2008 10:41
IS THERE ANY FUNCTION IN ORACLE LIKE MYSQL FUNCTION GROUP_CONCAT, ANY SUGGESSIONS APPRICIATED.


Just keep it in one thread please Wink

As this is an Oracle-forum knowledge about MySQL could - and will - be poort.

So could you give us an example of what the MySQL function GROUP_CONCAT actually does?


Ow, and don't post in UPPERCASE all the time, it's considered as shouting (and I have a bit of a headache now, and shouting doesn't help Wink )
Re: IS THERE ANY EQUIVALENT FUNCTION IN ORACLE LIKE GROUP_CONCAT IN MYSQL [message #312545 is a reply to message #312543] Wed, 09 April 2008 03:51 Go to previous messageGo to next message
pablolee
Messages: 2835
Registered: May 2007
Location: Scotland
Senior Member
Shouting gets you ignored. Typing in uppercase is the equivalent to shouting. Please read the forum guidelines before posting.
Re: like GROUP_CONCAT in Oracle [message #312549 is a reply to message #312541] Wed, 09 April 2008 03:59 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't multipost and follow the guidelines.

Regards
Michel
Re: like GROUP_CONCAT in Oracle [message #312551 is a reply to message #312549] Wed, 09 April 2008 04:10 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
There is no built-in function to do a group_concat, but it is fairly straightforwards to create a function to do it for you.

AskTom shows you how here

[Updated on: Wed, 09 April 2008 04:11]

Report message to a moderator

Re: like GROUP_CONCAT in Oracle [message #312675 is a reply to message #312551] Wed, 09 April 2008 10:34 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
There is a built-in function in 11g (wm_concat) but it is undocumented and therefore unsupported, so results are not guaranteed and it may not be available in future versions.

SCOTT@orcl_11g> desc wm_concat
FUNCTION wm_concat RETURNS VARCHAR2
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 P1                             VARCHAR2                IN

SCOTT@orcl_11g> select deptno, wm_concat (ename) as enames from emp group by deptno
  2  /

    DEPTNO ENAMES
---------- ---------------------------------------------
        10 CLARK,KING,MILLER
        20 SMITH,FORD,ADAMS,SCOTT,JONES
        30 ALLEN,BLAKE,MARTIN,TURNER,JAMES,WARD

SCOTT@orcl_11g>

Re: like GROUP_CONCAT in Oracle [message #312680 is a reply to message #312551] Wed, 09 April 2008 10:41 Go to previous message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
There is also the documneted collect function:

SCOTT@orcl_11g> create or replace type names as table of varchar2 (255);
  2  /

Type created.

SCOTT@orcl_11g> select deptno, cast (collect (ename) as names) as enames from emp group by deptno
  2  /

    DEPTNO ENAMES
---------- --------------------------------------------------------------------------------
        10 NAMES('CLARK', 'KING', 'MILLER')
        20 NAMES('SMITH', 'FORD', 'ADAMS', 'SCOTT', 'JONES')
        30 NAMES('ALLEN', 'BLAKE', 'MARTIN', 'TURNER', 'JAMES', 'WARD')

SCOTT@orcl_11g>

Previous Topic: error in procedure code
Next Topic: How do I select columns from changing tables ?
Goto Forum:
  


Current Time: Thu Dec 08 19:53:40 CST 2016

Total time taken to generate the page: 0.05843 seconds