Context Variables - Firebird

Firebird makes available a number of system-maintained variable values in the context of the current client connection and its activity. These context variables are available for use in SQL, including the trigger and stored procedure language, PSQL. Some are available only in PSQL and most are available only in dialect 3 databases. Table outlines Firebird’s context variables.

List of Context Variables

List of Context Variables

List of Context Variables

Points to Note

Remember that these are transient values.

  • CURRENT_CONNECTION and CURRENT_TRANSACTION have no meaning outside the current connection and transaction contexts, respectively. Do not treat them as perpetually unique, since the Firebird engine stores these identifiers on the database header page. After a restore, their series will be reinitialized to zero.
  • CURRENT_TIMESTAMP records the server time at the start of the operation and should not be relied upon as the sole sequencer of a batch of rows inserted or updated by a single statement.
  • Even though CURRENT_TIME is stored as the time elapsed since midnight on the server’s clock, it is a TIME value, not an interval of time. To achieve a time interval, use timestamps for start and finish times and subtract the start time from the finish time. The result will be a time interval in days.
  • The date/time context variables are based on server time, which may be different from the internal clock time on clients.

Examples Using Context Variables

This statement returns the server time at the moment the server serves the request of the Firebird client:


In this insert statement, the current transaction ID, the current server timestamp, and the system user name will be written to a table:


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Firebird Topics