Deprecated since version 3.0.
evalcommand has the following form:
The command contains the following fields:
Field Type Description
boolean Optional. By default,
evalblocks all other read and write operations to the database while the
evaloperation runs. Set
evalcommand to prevent the
eval command with
nolock set to
Changed in version 2.6.
If authorization is enabled, you must have access to all actions on all resources in order to run
eval. Providing such access is not recommended, but if your organization requires a user to run
eval, create a role that grants
anyAction on anyResource. Do not assign this role to any other user.
The following example uses
eval to perform an increment and calculate the average on the server:
db in the function refers to the current database.
If an error occurs,
eval throws an exception. The following invalid function uses the variable
x without declaring it as an argument:
The statement will result in the following exception: