<< Click to Display Table of Contents >> Navigation: Actions > DataBase > DB Exec SQL |
Processes an SQL query. The action is similar to the SQL Query action. But this action is performed within an opened database session. Thereby, you can process a series of queries in a single block.
General
SQL Query
Input an SQL query according to syntax. You can use parameters. It is necessary to put the colon (:) in front of the parameter name.
For example:
Select * from dept where city = :citypmt
citypmt is a parameter of the query.
Assign Rows affected to variable
Turn on this checkbox and input a variable name if you need to save the number of processed records into a variable.
SQL Parameters
Sometimes using of parameters of a query is more convenient instead of generation of the query by means of variables. For example, when the variable value contains quotes or another special symbols. If you use variables (or macro substitution) when forming SQL inquiry, availability such symbols can "break" the syntax of the query and you will get a runtime error.
Parameters SQL are designated in the inquiry by means of colon (:) before the parameter name.
For example:
Select * from employee where hiredate > :dt and salary >= :amount
:dt and :amount are parameters of the query.
Parameters can be several types:
•String – any string
•Integer – an integer number
•Float – a real number or the number with a floating dot.
•Boolean – a logical value True or False.
•DateTime – a date and time. The value of such parameter must be defined in current system format of date and time (see the system regional settings). Pay attention that using of date-time can have its own characteristics for different databases. For example, it is better specify such parameters for the MySQL as a string parameter in the format YYYY-MM-DD or YYYY-MM-DD hh:nn:ss.
Fill from SQL
Fill the list of parameters from the current query. If a parameter is already in the list, this parameter will be without change. The function fills only the missing parameters in the list.
Add
Add a parameter manually. You will be proposed to type or select from the list the parameter name, select the parameter type and input an expression as the parameter value.
Using of variables in a parameter name and in its value is allowed. The RoboTask will substitute variable values instead of variables before performing the SQL.
Edit
Edit the properties of the selected parameter.
Delete
Delete the selected parameter from the list.
If you specify the parameter which is absent in the query, the action ignores this parameter when performing and writes the proper warning in the log of the task.
Timeout
There you can change the time of waiting of a query process. On default, timeout is 60 seconds. But in case of need, it is possible to change this parameter.
Related Topics
Note: This feature is available for Business license only |