IS_ROLE_ACTIVATED

functionsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Context functions

Returns the VARCHAR value 'TRUE' if an account role is activated. You can check one role or several roles in a single call, and you can check activation in the session context or in the current execution context.

Syntax

Check role activation in the session

SYS_CONTEXT(
  'SNOWFLAKE$SESSION' ,
  'IS_ROLE_ACTIVATED' ,
  '<role>' [ , '<role>' ... ]
)

Check role activation in the current execution context

SYS_CONTEXT(
  'SNOWFLAKE$CURRENT' ,
  'IS_ROLE_ACTIVATED' ,
  '<role>' [ , '<role>' ... ]
)

Parameters

NameRequiredDescription
'SNOWFLAKE$SESSION'requiredSpecifies that you want to check role activation in the session context.
'SNOWFLAKE$CURRENT'requiredSpecifies that you want to check role activation in the current execution context. The current execution context can differ from the session context inside an owner’s rights executable or during an agent invocation. For more information, see SYS_CONTEXT (SNOWFLAKE$CURRENT namespace).
'IS_ROLE_ACTIVATED'requiredCalls the IS_ROLE_ACTIVATED function.
'role' [ , 'role' ... ]requiredSpecifies the account role or roles to check. You can pass one role or several roles as separate arguments. The function returns 'TRUE' if any of the specified roles is activated. Multiple roles must be constant values (see the usage notes).

Returns

The function returns one of the following VARCHAR values: - 'TRUE' if any of the specified account roles is activated in the specified context. - 'FALSE' if none of the specified account roles is activated, or if none of the specified roles exists. To compare this return value against the BOOLEAN value TRUE or FALSE, cast the return value to BOOLEAN. For example: 2026_06 behavior change bundle When the 2026_06 behavior change bundle is enabled in your account, when you call this function through SYS_CONTEXT, it returns BOOLEAN instead of the VARCHAR string 'TRUE' or 'FALSE'. Existing casts, such as ::BOOLEAN or ::NUMBER, continue to work unchanged. For the return type of every property and function by namespace, see SYS_CONTEXT return types.

Usage notes

See also

Referenced by