18.4 Context Attribute Definition or Usage Issues

Troubleshoot issues related to creating, validating, and using end-user context attributes.

18.4.1 Cannot Create a Context Attribute Definition Object

If the CREATE END USER CONTEXT statement fails, the executing user may lack the required privilege or the JSON schema payload may be invalid.

Issue description

The CREATE END USER CONTEXT statement fails when the administrator attempts to create a custom end-user context attribute definition.

Probable causes

  • The executing user does not have the CREATE END USER CONTEXT privilege.
  • The JSON schema payload provided in the statement is invalid or does not conform to the required schema format.

Resolution procedure

  1. Verify that the CREATE END USER CONTEXT privilege has been granted to the executing user.
  2. Ensure that the JSON schema payload conforms to valid JSON syntax.

18.4.2 Context Attribute Cannot Be Used in Session

If a defined context attribute cannot be read or updated within a session, the attribute definition may be misconfigured, the required privileges may not be granted, or the associated PL/SQL callbacks may be invalid.

Issue description

A context attribute that has been defined cannot be read or updated within an end-user session. Queries or data grant predicates that reference the attribute fail or return unexpected results.

Probable causes

  • The context attribute definition was not created properly or does not exist.
  • The required SELECT (and UPDATE, if applicable) privilege on the specific end-user context has not been granted to the end user through a data grant or as a system privilege.
  • PL/SQL callbacks used for loading the attribute are invalid, or the EXECUTE privilege on the PL/SQL package has not been granted.

Resolution procedure

  1. Confirm that the context attribute definition exists and is correctly configured by querying the DBA_END_USER_CONTEXT_DEFINITIONS view.
  2. Verify that the SELECT privilege (and the UPDATE privilege, if the attribute must be writable) on the specific end-user context has been granted to the end user through a data grant or as a system privilege.
  3. If PL/SQL callbacks are used to load the attribute value, verify the following:
    • The PL/SQL package and procedure referenced in the context definition are valid.
    • The EXECUTE privilege on the PL/SQL package has been granted to the appropriate user or role.
  4. If the issue persists, enable diagnostic tracing and examine the trace output. See Enable Diagnostic Tracing.