6. Working with Transactions and Handling Errors : Ways to Obtain Status Information : SESSION_PRIV Function--Determine If Session Has a Privilege
 
Share this page                  
SESSION_PRIV Function--Determine If Session Has a Privilege
The SESSION_PRIV function determines whether the current session has a subject privilege, or can request it.
This function has the following format:
SESSION_PRIV('subject_priv')
where subject_priv is any single subject privilege name, such as operator, specified as a text string in upper or lower case. Valid subject privileges are listed under Create Profile (see CREATE PROFILE).
The following values are returned:
Y
Indicates session has privilege.
N
Indicates session does not have the privilege.
R
Indicates the session can request the privilege and make it active.
Example--The following checks whether the current session has auditor privilege:
SELECT SESSION_PRIV('AUDITOR');