IS_DATABASE_ROLE_ACTIVATED

functionsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Context functions

Returns the VARCHAR value 'TRUE' if a database role is activated. You can check activation in the session context or in the current execution context.

Syntax

Check database role activation in the session

SYS_CONTEXT(
  'SNOWFLAKE$SESSION' ,
  'IS_DATABASE_ROLE_ACTIVATED' ,
  '<database_role>'
)

Check database role activation in the current execution context

SYS_CONTEXT(
  'SNOWFLAKE$CURRENT' ,
  'IS_DATABASE_ROLE_ACTIVATED' ,
  '<database_role>'
)

Parameters

NameRequiredDescription
'SNOWFLAKE$SESSION'requiredSpecifies that you want to check database role activation in the session context.
'SNOWFLAKE$CURRENT'requiredSpecifies that you want to check database 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_DATABASE_ROLE_ACTIVATED'requiredCalls the IS_DATABASE_ROLE_ACTIVATED function.
'database_role'requiredSpecifies the database role to check. The name can be fully qualified or relative.

Returns

The function returns one of the following VARCHAR values: - 'TRUE' if the specified database role is in the active role hierarchy of the specified context. - 'FALSE' if the specified database role isn’t in the active role hierarchy, or if the database role doesn’t exist. 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, this function continues to return VARCHAR (the string 'TRUE' or 'FALSE') rather than BOOLEAN. 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