SELECT
F.SUBJ_NAME AS FOLDER_NAME
, WF.TASK_ID AS WORKFLOW_ID
, WF.TASK_NAME AS WORKFLOW_NAME
, SE.INSTANCE_NAME AS SESSION_NAME
--, TSK.TASK_NAME
, OPB_SESS_FILE_VALS.DIR_NAME AS DIR_NAME
, OPB_SESS_FILE_VALS.FILE_NAME AS FILE_NAME
FROM
OPB_SUBJECT F,
OPB_TASK WF ,
(SELECT
WORKFLOW_ID,
INSTANCE_ID,
TASK_ID,
TASK_TYPE,
INSTANCE_NAME,
MAX(VERSION_NUMBER) FROM OPB_TASK_INST SESS
WHERE SESS.TASK_TYPE=68 GROUP BY
WORKFLOW_ID,INSTANCE_ID,TASK_ID,TASK_TYPE,INSTANCE_NAME) SE,
(SELECT SESSION_ID,MAPPING_ID,MAX(VERSION_NUMBER) FROM OPB_SESSION GROUP BY SESSION_ID,MAPPING_ID) S
LEFT JOIN OPB_TASK TSK ON ( TSK.TASK_ID = S.SESSION_ID )
LEFT JOIN OPB_SESS_FILE_VALS ON ( OPB_SESS_FILE_VALS.SESSION_ID = S.SESSION_ID )
WHERE 1=1
AND WF.IS_VISIBLE = 1
AND WF.SUBJECT_ID = F.SUBJ_ID
AND SE.WORKFLOW_ID = WF.TASK_ID
AND WF.TASK_TYPE = 71
AND SE.TASK_ID = S.SESSION_ID
AND OPB_SESS_FILE_VALS.SESSION_ID=TSK.TASK_ID
AND TSK.TASK_TYPE=68
-- AND F.SUBJ_NAME='MANKELI'
ORDER BY FOLDER_NAME , WORKFLOW_NAME , SESSION_NAME
;
/*
SELECT CASE WHEN ROWNUM = 1 THEN ' ' ELSE ' , ' END
|| TABLE_NAME || '.' || COLUMN_NAME FROM ALL_TAB_COLUMNS
WHERE 1=1
AND TABLE_NAME = 'REP_SESS_CONFIG_PARM'
;
*/