Execute SQL
The Execute SQL action submits an SQL statement to a database and optionally stores the number of affected rows in a variable. Any other results returned by the database are ignored. In other words, this action is intended for SQL insert, update, and delete statements, but can also be used to invoke stored procedures and the like. The SQL is specified using an expression.
- The SQL statement is not executed during execution in Design mode in Design Studio.
- The SQL statement is executed enclosed in an individual transaction, one for each step. It is not possible to let transactions span several consecutive calls to Execute SQL and/or Query Database.
- " Execute SQL" does not currently support prepared (bind) statements or callable statements.
Do not execute use <Some Other DB> command in the SQL statements, because this will change the results of all future SQL commands (in the same robot or others).
Properties
The Execute SQL action can be configured using the following properties:
- Database
-
Select which database this action should submit its query to by using the drop-down list of databases available to Design Studio.
- SQL
-
This field must contain a valid SQL statement in the form of an expression. The value of this expression is submitted to the chosen database.
- Timeout
-
Specify the timeout for submitting SQL statements in seconds. Select a variable or a value option to define the preferred timeout. The value must be greater than zero.
The timeout is enforced through DBMS and if it is reached, the Execute SQL action stops executing with an error message specific to the database.
Various DBMS types and JDBC drivers may handle timeouts differently. For example, not every system allows a timeout to trip in the middle of certain statements.
- Modified Rows
-
Select a text or integer variable in which to store the number of rows affected by the SQL statement. This is optional.
- Execute in Design Mode
-
If this is enabled, the step will be executed even in Design Mode inside Design Studio. If this is disabled, the step will do nothing when navigating the robot in Design Mode.