21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Available in: DSQL, PSQL<br />

Added in: <strong>2.1</strong><br />

Internal functions<br />

RAND()<br />

Description: Returns a random number between 0 and 1.<br />

Result type: DOUBLE PRECISION<br />

Syntax:<br />

RAND ()<br />

Important<br />

If the external function RAND is declared in your database, it will override the internal function. To make the<br />

internal function available, DROP or ALTER the external function (UDF).<br />

Note<br />

RDB$GET_CONTEXT()<br />

RDB$GET_CONTEXT and its counterpart RDB$SET_CONTEXT are actually predeclared UDFs. They are listed<br />

here as internal functions because they are always present – the user doesn't have to do anything to make them<br />

available.<br />

Available in: DSQL, ESQL, PSQL<br />

Added in: 2.0<br />

Description: Retrieves the value of a context variable from one of the namespaces SYSTEM, USER_SESSION<br />

and USER_TRANSACTION.<br />

Result type: VARCHAR(255)<br />

Syntax:<br />

RDB$GET_CONTEXT ('', '')<br />

::= SYSTEM | USER_SESSION | USER_TRANSACTION<br />

::= A case-sensitive string of max. 80 characters<br />

The namespaces:<br />

The USER_SESSION and USER_TRANSACTION namespaces are initially empty. The user can create and set<br />

variables in them with RDB$SET_CONTEXT() and retrieve them with RDB$GET_CONTEXT(). The SYSTEM<br />

namespace is read-only. It contains a number of predefined variables, shown in the table below.<br />

151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!