Categories:

Context Functions (Session Object)

CURRENT_ROLE

Returns the name of the role in use for the current session.

To specify a different role for the session, execute the USE ROLE command.

Syntax

CURRENT_ROLE()

Arguments

None.

Usage Notes

  • Granting access on a secure UDF or secure view that contains CURRENT_ROLE to a share is allowed. When the secure UDF or secure view is accessed from the data sharing consumer account, CURRENT_ROLE always returns a NULL value.

Examples

This demonstrates CURRENT_ROLE():

SELECT CURRENT_ROLE();

Output:

+----------------+
| CURRENT_ROLE() |
|----------------|
| SYSADMIN       |
+----------------+