SYS_CONTEXT(namespace, attribute_name [,length])

Returns the value of an attribute in an application context namespace.



Specifies the name of a namespace previously created using the CREATE CONTEXT statement. You may also specify the default namespace USERENV.


Specifies the name of an attribute within the namespace. That attribute's value is then returned by this function. Several predefined attributes are available for use with the default USERENV namespace. These attributes are listed in Table 5-6.


Specifies the length you want to allow for an attribute's return value. This optional parameter is only available beginning with Oracle 8.1.6, and only for the AUTHENTICATION_DATA attribute.

Table 5-6. Predefined Attributes in the USERENV Namespace
Attribute Name Description Max Length Release Introduced
AUTHENTICATION_DATA The data used to authenticate a user. If authentication is via an X.503 certificate, the content of the certificate will be returned in hexadecimal format. This is the only option for which the SYS_CONTEXT function's LENGTH parameter may be used. The maximum length you can specify is 4000 bytes. 2564000 8.1.6
AUTHENTICATION_TYPE Indicates how the user was authenticated. One of the following values will be returned:
  • DATABASE: a username and password were used.

  • OS: operating system authentication was used.

  • NETWORK: authentication was via a network protocol or the Advanced Networking Option (ANO).

  • PROXY: authentication ...

Get Oracle SQL: the Essential Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.