The ExecuteStatement Method

Previous Next

See Also

The internal Rules Engine ExecuteStatement method executes a dynamic SQL statement. For example:

SELECT RulesEngine.ExecuteStatement ('insert into tour values(''ITALY'',''TUSCANY'')')

Each statement input parameter can only contain one SQL statement: it is not possible to use multiple SQL statements separated by semicolons ';'.

The Default behavior upon success or failure of SQL statements as follows:

If a statement succeeds, the method does not return a record.

If a statement fails, the method returns a record with one output column: this column contains the error message. This will NOT stop subsequent records with statements to be executed. Also, other parts of the product will NOT react on this as an error (for example in USoft Batch: abort-job-on-error will not be triggered by such an error).

The method however has a second, optional parameter: GenerateError. By default this is set to 'No' and will result in the behavior described above. When this parameter is set to 'Yes', an error in an executed statement will generate an error message, thus stopping the INVOKE (no more statements will be executed) and other parts of the product will react on this error.