COLUMN APPLY_NAME FORMAT A30
COLUMN STATE FORMAT A10
COLUMN COMMITSCN FORMAT 999999999999999

COLUMN STATE FORMAT A10
COLUMN local_transaction_id FORMAT A20
COLUMN error_message FORMAT A70


select '' apply_name, '' local_transaction_id, NULL ERROR_CREATION_TIME , '' error_message from dual
union all
select apply_name, local_transaction_id, TO_CHAR(ERROR_CREATION_TIME,'DD/MM/YYYY HH24:MI:SS') ERROR_CREATION_TIME, error_message from dba_apply_error
ORDER BY 1,3;

SELECT ap.APPLY_NAME,
      SUBSTR(s.PROGRAM,INSTR(S.PROGRAM,'(')+1,4) PROCESS,
      c.STATE,
      c.TOTAL_RECEIVED RECEIVED,
      c.TOTAL_ASSIGNED ASSIGNED,
      c.TOTAL_APPLIED APPLIED,
      c.TOTAL_ERRORS ERRORS,
      c.total_ignored,
      c.total_rollbacks,
      c.TOTAL_WAIT_DEPS WAIT_DEPS, c.TOTAL_WAIT_COMMITS WAIT_COMMITS
      FROM gV$STREAMS_APPLY_COORDINATOR  c, gV$SESSION s, DBA_APPLY ap
      WHERE c.SID = s.SID AND
            c.SERIAL# = s.SERIAL# AND
            c.APPLY_NAME = ap.APPLY_NAME
order by 1;
