15.00 - USER - 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)

USER

Purpose  

Provides the session user name.

Syntax  

ANSI Compliance

This is ANSI SQL:2011 compliant.

Result Type and Attributes

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

 

Data Type

Format

Title

VARCHAR(30) CHARACTER SET UNICODE

X(30)

User

Result Value

 

IF the session logon is …

THEN …

not directory-based

the result value is the session user name.

directory-based

If the session maps to a permanent table, the result value is the name of the permanent user.

If the session does not map to a permanent user, the result value is the authcid of the external user.

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

Example  

You can identify the session user name with the following statement:

   SELECT USER;

The system responds with something like the following.

   User
   ------------------------------
   JJ43901

Example  

The following example selects the job title for the session user.

   SELECT JobTitle FROM Employee WHERE Name = USER;