Friday, May 16, 2014

Combine Multiple Rows into Single Row using LISTAGG

The LISTAGG function can be used in the following versions of Oracle/PLSQL:
·         Oracle 12c, Oracle 11g Release 2

SELECT listagg (full_name, ',') WITHIN GROUP (ORDER BY person_id) enames
  FROM per_all_people_f
 WHERE SYSDATE BETWEEN effective_start_date AND effective_end_date
       AND ROWNUM < 10

Release less than the above, use the following

SELECT wm_concat  (SUPINV_NO)  supplier_invoice
  FROM ap_inv_masters
  where  appv_id = 1045

No comments:

Post a Comment