FirebirdSQL logo

RDB$GET_CONTEXT()

Retrieves the value of a context variable from a namespace

Result type

VARCHAR(255)

Syntax
RDB$GET_CONTEXT ('<namespace>', <varname>)

<namespace> ::= SYSTEM | USER_SESSION | USER_TRANSACTION | DDL_TRIGGER
<varname>   ::= A case-sensitive quoted string of max. 80 characters
Table 1. RDB$GET_CONTEXT Function Parameters
Parameter Description

namespace

Namespace

varname

Variable name;case-sensitive with a maximum length of 80 characters

The namespaces

The USER_SESSION and USER_TRANSACTION namespaces are initially empty.A user can create and set variables with RDB$SET_CONTEXT() and retrieve them with RDB$GET_CONTEXT().The SYSTEM namespace is read-only.The DDL_TRIGGER namespace is only valid in DDL triggers, and is read-only.The SYSTEM and DDL_TRIGGER namespaces contain a number of predefined variables, shown below.

Return values and error behaviour

If the polled variable exists in the given namespace, its value will be returned as a string of max. 255 characters.If the namespace doesn’t exist or if you try to access a non-existing variable in the SYSTEM or DDL_TRIGGER namespace, an error is raised.If you request a non-existing variable in one of the user namespaces, NULL is returned.Both namespace and variable names must be given as single-quoted, case-sensitive, non-NULL strings.