The SYS_CONTEXT function returns the parameters related to the current namespace.
Syntax
SYS_CONTEXT(namespace,parameter)Parameters
| Parameter | Description |
|---|---|
| namespace | The namespace. Only the USERENV value that describes the current session is supported. |
| parameter | The parameters related to the namespace. For more information about supported values, see Parameter list. |
Parameter list
| Parameter | Description |
|---|---|
| SESSIONID | The ID of the session. |
| SESSION_SCHEMA | The current default schema of the session. |
| CURRENT_USERID | The ID of the current user. |
| LANG | The encoding of the current database. |
| OS_USER | The operating system authenticated user for the current backend. |
| TERMINAL | The application name. |
| CLIENT_IDENTIFIER | The ID of the client. |
| MODULE | The current module (DBMS_APPLICATION_INFO.MODULE) in the session. For more information, see DBMS_APPLICATION_INFO. |
| ACTION | The current action (DBMS_APPLICATION_INFO.ACTION) in the session. For more information, see DBMS_APPLICATION_INFO. |
| ISDBA | Specifies whether the permission of the current account is superuser or polar_superuser. |
| DB_NAME | The name of the current database. |
| DATABASE_ROLE | The role of the database. The following role types are supported:
|
| SESSION_USERID | The user ID of the current session. |
| CLIENT_INFO | The client_info field (DBMS_APPLICATION_INFO.CLIENT_INFO) in the session. For more information, see DBMS_APPLICATION_INFO. |
| HOST | The client hostname of the current session. |
| IP_ADDRESS | The client IP address of the current session. |
| SERVER_HOST | The server hostname of the current session. |
Usage examples
The following example shows the function when parameter is set to SESSIONID.
SELECT SYS_CONTEXT('USERENV','SESSIONID');