0% found this document useful (0 votes)
55 views

WF Run Stats Guarav

This SQL query selects the subject area, workflow name, status, and number of reruns from the REP_WORKFLOWS and REP_WFLOW_RUN tables in the BOB_DEV_EDW_REP schema. It joins these tables to retrieve the latest status and count the number of reruns for each unique subject and workflow. The output will include the folder name, workflow name, current status, and number of times it has been rerun since the last successful run.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

WF Run Stats Guarav

This SQL query selects the subject area, workflow name, status, and number of reruns from the REP_WORKFLOWS and REP_WFLOW_RUN tables in the BOB_DEV_EDW_REP schema. It joins these tables to retrieve the latest status and count the number of reruns for each unique subject and workflow. The output will include the folder name, workflow name, current status, and number of times it has been rerun since the last successful run.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT W.SUBJECT_AREA, W.WORKFLOW_NAME, DECODE(A.RUN_STATUS_CODE,1,'SUCCEEDED', 2,'DISABLED', 3,'FAILED', 4,'STOPPED', 5,'ABORTED', 6,'RUNNING', 15,'TERMINATED') STATUS, NVL(STATS.REREUN, 0) RERUN FROM BOB_DEV_EDW_REP.

REP_WORKFLOWS W INNER JOIN (SELECT SUBJECT_ID, WORKFLOW_ID, RUN_STATUS_CODE FROM BOB_DEV_EDW_REP.REP_WFLOW_RUN WHERE (SUBJECT_ID, WORKFLOW_ID, END_TIME) IN (SELECT SUBJECT_ID, WORKFLOW_ID, MAX(END_TIME) FROM BOB_DEV_EDW_REP.REP_WFLOW_RUN A GROUP BY SUBJECT_ID, WORKFLOW_ID)) A ON A.SUBJECT_ID = W.SUBJECT_ID AND A.WORKFLOW_ID =W.WORKFLOW_ID LEFT OUTER JOIN (SELECT A.SUBJECT_ID, A.WORKFLOW_ID, COUNT(1) AS REREUN FROM BOB_DEV_EDW_REP.REP_WFLOW_RUN A INNER JOIN (SELECT SUBJECT_ID, WORKFLOW_ID, MAX(END_TIME) END_TIME FROM BOB_DEV_EDW_REP.REP_WFLOW_RUN WHERE (SUBJECT_ID, WORKFLOW_ID, END_TIME) NOT IN (SELECT SUBJECT_ID, WORKFLOW_ID, MAX(END_TIME) FROM BOB_DEV_EDW_REP.REP_WFLOW_RUN GROUP BY SUBJECT_ID, WORKFLOW_ID) AND RUN_STATUS_CODE = 1 GROUP BY SUBJECT_ID, WORKFLOW_ID) B ON A.SUBJECT_ID =B.SUBJECT_ID AND A.WORKFLOW_ID =B.WORKFLOW_ID AND A.END_TIME >B.END_TIME AND A.RUN_STATUS_CODE <> 1 GROUP BY A.SUBJECT_ID, A.WORKFLOW_ID) STATS ON A.SUBJECT_ID =STATS.SUBJECT_ID AND A.WORKFLOW_ID =STATS.WORKFLOW_ID

It will give output for all the workflow as FOLDER NAME, WORKFLOW_NAME, CURRENT STATUS, Number of time it has been rerun from last success

And later if we found that to be useful, we can modified accordingly.

You might also like