Следующий SQL сопоставляет столбцы SYSCAT.DBAUTH
с именами привилегий, используемых в инструкциях GRANT (или REVOKE)
SELECT A.GRANTEE AS AUTHID
, A.GRANTEETYPE AS AUTHIDTYPE
, B.PRIVILEGE
, CASE WHEN B.AUTH = 'G' THEN 'Y' ELSE 'N' END AS GRANTABLE
, CURRENT SERVER AS OBJECTNAME
, '' AS OBJECTSCHEMA
, CAST ('DATABASE' AS VARCHAR (11)) AS OBJECTTYPE
FROM SYSCAT.DBAUTH A
, LATERAL(VALUES
(BINDADDAUTH ,'BINDADD')
, (CONNECTAUTH ,'CONNECT')
, (CREATETABAUTH ,'CREATETAB')
, (DBADMAUTH ,'DBADM')
, (EXTERNALROUTINEAUTH ,'CREATE_EXTERNAL_ROUTINE')
, (IMPLSCHEMAAUTH ,'IMPLICIT_SCHEMA')
, (LOADAUTH ,'LOAD')
, (NOFENCEAUTH ,'CREATE_NOT_FENCED_ROUTINE')
, (QUIESCECONNECTAUTH ,'QUIESCE_CONNECT')
, (LIBRARYADMAUTH ,'LIBRARYADMAUTH')
, (SECURITYADMAUTH ,'SECADM')
, (SQLADMAUTH ,'SQLADM')
, (WLMADMAUTH ,'WLMADM')
, (EXPLAINAUTH ,'EXPLAIN')
, (DATAACCESSAUTH ,'DATAACCESS')
, (ACCESSCTRLAUTH ,'ACCESSCTRL')
) B ( AUTH, PRIVILEGE )
WHERE B.AUTH IN ('Y','G')