View Single Post
  #12 (permalink)  
Old 07-19-2007, 07:59 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Use on group_concat

Hi Priyan,

Yes its not similar to MYSQL GROUP_CONCAT().

Not a simple one using SELECT Query but the other way using a PL/SQL Block we can get the same result as per the MYSQL GROUP_CONCAT().

PHP Code:
SET SERVEROUTPUT ON;
DECLARE
vName          VARCHAR(100);
BEGIN
FOR I IN(SELECT ENAME FROM EMP)
LOOP
  
IF(vName IS NULL)THEN
     vName 
:= I.ENAME;
  ELSE
     
vName := CONCAT(CONCAT(vName,','),I.ENAME);
  
END IF;
END LOOP;  
DBMS_OUTPUT.PUT_LINE('The Names From Emp Table:'||vName);
END
HTML Code:
Output:
The Names From Emp Table: John,Raj,Selvam,Smith,Kumar.
PL/SQL procedure successfully completed.
__________________
-Murali..
Reply With Quote