程式碼
SELECT A.USER_ID
, A.USER_NAME
, FU.DESCRIPTION USER_DESC
, FR.RESPONSIBILITY_ID
, FR.RESPONSIBILITY_NAME
, COUNT(*) FORM_COUNT
FROM (SELECT RESPONSIBILITY_ID
, USER_ID
, USER_NAME
FROM FND_SIGNON_AUDIT_VIEW
) A
, ORG_ACCESS OA
, FND_RESPONSIBILITY_TL FR
, FND_USER FU
WHERE A.USER_ID = FU.USER_ID
AND A.RESPONSIBILITY_ID = OA.RESPONSIBILITY_ID(+)
AND A.RESPONSIBILITY_ID = FR.RESPONSIBILITY_ID(+)
AND OA.ORGANIZATION_ID = &ORGANIZATION_ID
GROUP BY A.USER_NAME, A.USER_ID, FU.DESCRIPTION, FR.RESPONSIBILITY_ID, FR.RESPONSIBILITY_NAME
ORDER BY A.USER_NAME, A.USER_ID, FU.DESCRIPTION, FR.RESPONSIBILITY_ID, FR.RESPONSIBILITY_NAME;