Applicant Search View
SELECT A.CANDIDATE_ID
FROM PS_FO_CANDIDATE_W A
,PS_SCRTY_TBL_DEPT SEC
WHERE A.CANDIDATE_TYPE IN ('A')
AND SEC.ACCESS_CD='Y'
AND EXISTS (
SELECT 'X'
FROM PSTREENODE TN
WHERE TN.SETID = SEC.SETID
AND TN.SETID = A.SETID_DEPT
AND TN.TREE_NAME='DEP_SECURITY'
AND TN.EFFDT= SEC.TREE_EFFDT
AND TN.TREE_NODE=A.DEPTID
AND TN.TREE_NODE_NUM BETWEEN SEC.TREE_NODE_NUM AND SEC.TREE_NODE_NUM_END
AND NOT EXISTS (
SELECT 'X'
FROM PS_SCRTY_TBL_DEPT SEC2
WHERE SEC.ROWSECCLASS = SEC2.ROWSECCLASS
AND SEC.SETID = SEC2.SETID
AND SEC.TREE_NODE_NUM <> SEC2.TREE_NODE_NUM
AND TN.TREE_NODE_NUM BETWEEN SEC2.TREE_NODE_NUM AND SEC2.TREE_NODE_NUM_END
AND SEC2.TREE_NODE_NUM BETWEEN SEC.TREE_NODE_NUM AND SEC.TREE_NODE_NUM_END )) |