15.00 - ROLE - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)
Last Update
2018-09-24

ROLE

Purpose  

Returns the session current role.

Syntax  

ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Result Type and Attributes

The data type, format, and title for ROLE are as follows:

 

Data Type

Format

Title

VARCHAR(30) CHARACTER SET UNICODE

X(30)

Role

Result Value

The session logon can be not directory-based or directory-based.

If you are accessing the Teradata Database through a proxy connection, and you want to get the current role of the proxy user, use the CURRENT_ROLE built-in function. For details, see “CURRENT_ROLE” on page 353.

Session logon is not directory-based

If the session logon is not directory-based, refer to the following table.

 

Current Role for the Session

Result Value

Existing role

Name of the role

ALL

'ALL'

NONE or NULL

NULL

Session logon is directory-based

If the session logon is directory-based, refer to the following table.

 

Session

Result Value

Assigned a set of directory-managed roles and does not change the current role

'EXTERNAL'

Uses a SET ROLE EXTERNAL statement

  • does not have an assigned set of directory-managed roles,
  • maps to a permanent user that has a default database-managed role, and
  • does not change the current role
  • Name of the default role of the permanent user

    Uses a SET ROLE role_name statement, where role_name is either a directory-managed or database-managed role

    Name of the specified role

    Uses a SET ROLE ALL statement

    'ALL'

  • Not assigned a set of directory-managed roles,
  • Does not change the current role, and one of the following condition is true”
  • Directory-based logon does not map to a permanent user
  • Permanent user that the directory-based logon maps to does not have a default database-managed role
  • NULL

     

     

    Uses a SET ROLE NONE statement

    Uses a SET ROLE NULL statement

    Usage Notes  

    ROLE is not supported in the FastLoad and MultiLoad utilities.

    Example  

    You can identify the session current role with the following statement:

       SELECT ROLE;

    The system responds with something like the following:

       Role
       ------------------------------
       EXTERNAL