          nvl(trim(dbms_xplan.format_number(sum(io_reqs))),' ') io_reqs,
          nvl(trim(dbms_xplan.format_size(sum(io_bytes))),' ') io_bytes,
          to_char(SUM(aas0)) aas,
-         listagg(CASE WHEN r <= 7 AND c0 = 1 THEN id || '(' || aas || ')' END, ',') within GROUP(ORDER BY aas DESC) Plan_lines,
-         listagg(CASE WHEN r1 <= 5 AND c1 = 1 THEN SUBSTR(OBJ1, 1, 32) || '(' || aas1 || ')' END, ',') within GROUP(ORDER BY aas1 DESC,OBJ1 DESC) wait_objects
+         listagg(CASE WHEN r <= 7 AND c0 = 1 THEN id || '(' || aas || '%)' END, ',') within GROUP(ORDER BY aas DESC) Plan_lines,
+         listagg(CASE WHEN r1 <= 5 AND c1 = 1 THEN SUBSTR(OBJ1, 1, 32) || '(' || aas1 || '%)' END, ',') within GROUP(ORDER BY aas1 DESC,OBJ1 DESC) wait_objects
   FROM   (SELECT OBJ top_item,
                  OBJ1,
                  nvl(ID, 0) ID,

         greatest(MAX(LENGTH(io_bytes)),8) c8,
         count(1) cnt
  FROM ash_agg),

plan_agg as(
  SELECT /*+materialize*/ 
         SQL_PLAN_HASH_VALUE PLAN_HASH,

           ROUND(COUNT(DECODE(wl, 'Concurrency', 1)) * 100 / COUNT(1), 1) "CC",
           ROUND(COUNT(DECODE(wl, 'Application', 1)) * 100 / COUNT(1), 1) "APP",
           ROUND(COUNT(CASE WHEN wl NOT IN ('ON CPU','User I/O','System I/O','Cluster','Concurrency','Application') THEN 1 END) * 100 / COUNT(1), 1) oth,
           MAX(&OBJ||'('||tenv||'%)') KEEP(dense_rank LAST ORDER BY tenv) top_event
    FROM   ash
    GROUP  BY nvl(SQL_PLAN_LINE_ID,0)),
ash_agg AS
