ORACLE/PLSQL: SYS_CONTEXT FUNCTION This Oracle tutorial explains how to use the Oracle/PLSQL SYS_CONTEXT function with syntax and examples.
DESCRIPTION The Oracle/PLSQL SYS_CONTEXT function can be used to retrieve information about the Oracle environment.
SYNTAX The syntax for the Oracle/PLSQL SYS_CONTEXT function is: SYS_CONTEXT( namespace, parameter, [ length ] )
Parameters or Arguments namespace is an Oracle namespace that has already been created. If the namespace of 'USERENV' is used, attributes describing the current Oracle session can be returned. parameter is a valid attribute that has been set using the DBMS_SESSION.set_context procedure. length is optional. It is the length of the return value in bytes. If this parameter is omitted or if an invalid entry is provided, the sys_context function will default to 256 bytes.
NOTE The valid parameters for the namespace called 'USERENV' are as follows: (Note that not all parameters are valid in all versions of Oracle)
Parameter
Explanation
Oracle Oracle Oracle 9i 10g 11g
ACTION
Returns the position in the module
No
Yes
Yes
AUDITED_CURSORID
Returns the cursor ID of the SQL that triggered the audit
Yes
Yes
Yes
AUTHENTICATED_IDENTITY
Returns the identity used in authentication
No
Yes
Yes