1-- List privileges, including roles, for my_user
2SELECT GRANTEE, PRIVILEGE AS PRIVILEGE_ROLE,
3 NULL AS OWNER, NULL AS TABLE_NAME, NULL AS COLUMN_NAME,
4 ADMIN_OPTION AS PRIVILEGE,
5 NULL AS GRANTABLE
6FROM DBA_SYS_PRIVS WHERE GRANTEE = 'my_user'
7UNION ALL
8SELECT r.GRANTEE, r.GRANTED_ROLE AS PRIVILEGE_ROLE, p.OWNER, p.TABLE_NAME,
9 p.COLUMN_NAME, PRIVILEGE, p.GRANTABLE
10FROM DBA_ROLE_PRIVS r LEFT JOIN ROLE_TAB_PRIVS p ON p.ROLE = r.GRANTED_ROLE
11WHERE r.GRANTEE = 'my_user';