Oracle default Aggregate Function Script

Concatenate string : LISTAGG Analytic Function in 11g Release 2
The LISTAGG analytic function was introduced in Oracle 11g Release 2,  default aggregate strings.

Example 1:
SELECT LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employees
FROM   emp;

EMPLOYEES
---------- --------------------------------------------------
CLARK,KING,MILLER,ADAMS,FORD,JONES,SCOTT,SMITH,ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD


Example 2:
Select LISTAGG(gm.attribute2, ',') WITHIN GROUP (ORDER BY gm.attribute2) 
from gme.gme_material_details gm



Example 3:
SELECT deptno, LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employees
FROM   emp
GROUP BY deptno;

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

Calculate Average Completed Time on Concurrent Program

/*Calculate Average Oracle Concurrent Program Completed Time*/

select avg(fr1.actual_completion_date - fr1.actual_start_date) avgCPtime
  from fnd_concurrent_requests fr1
         , fnd_concurrent_requests fr2
  where fr2.request_id = NVL(:P_request_ID, fr2.request_id)
  and fr1.concurrent_program_id = fr2.concurrent_program_id
  and fr1.program_application_id = fr2.program_application_id
  and fr1.actual_start_date is not null
  and fr1.actual_completion_date is not null;