System functions provide access to information in the Data Virtuality Server system via a query. Here's an overview of them:

Return value type
CURRENT_DATABASE()Retrieves catalogue name of the databaseString
DV_SESSION_SET('name', value)Sets the indicated session variable to the indicated valueObject
DV_SESSION_GET('name')Retrieves the value (null if no value has been set)Object
ENV('key')Retrieves the system (i.e. the Data Virtuality Server) property specified by keyString
SESSION_ID()Retrieves current session ID in string formString

Retrieves the current request ID

USER()Retrieves the name of the user executing the queryString

Calling any system function is very simple - here's how to run USER(), for example:

System functions' names are not case-sensitive: both USER() and user() will work.

Special Note on ENV('key')

One important thing to remember about this function is that it is not enabled by default for security reasons, to prevent untrusted access to system properties. To enable it, you'll need to use the following command and restart the Data Virtuality Server:

EXEC SYSADMIN.executeCli('/subsystem=teiid:write-attribute(name=allow-env-function,value=true)');;

Special Note on DV_SESSION_SET('name', value) and DV_SESSION_GET('name')

Unlike other system functions described above, these two go together, and their purpose is to set and read variables at the session level. 

The first function sets the indicated variable to the indicated value and returns the old value, and the second retrieves the current value (if no value has been set previously, null will be returned). Variables are key-value pairs; the name is a string, and the value and the return value are objects. 

A special case is the dv.maxRecursion session variable: it is a session variable per se, with a fixed default value which can be modified using DV_SESSION_SET('name', value)

SELECT DV_SESSION_SET('dv.maxRecursion', 25);;