The SYS_CONTEXT is an advanced function that the Oracle database supports. It is used to get information about the Oracle environment. The SYS_CONTEXT function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.
Syntax:
SYS_CONTEXT( namespace, parameter, length )
Parameters:
namespace: It is used to specify the already created namespace.
parameter: It is used to specify a valid attribute (set using the DBMS_SESSION.set_context procedure).
length: It is an optional parameter which is used to specify the length of the return value in bytes. It has a default value of 256 bytes.
Example:
SYS_CONTEXT('USERENV', 'NLS_DATE_FORMAT') |
Output:
'RR-MM-DD'