Query Database
Use this step to extract data from the selected database. To change records in your database, use the Execute SQL step. To store data in a database, use the Store In Database step.
This step opens an application in the Recorder View with one extracted row. The row data is available in the Table and Tree views. This step works as a loop step that iterates over the rows returned by the query. Each iteration updates the contents of the views with data extracted for the next row. After all rows are iterated (or the robot exits the loop with exception or a Break step) the application automatically closes. It also closes if the robot stops execution.
The robot may use Iteration variable and Continue and Break steps to control the loop execution as other loop steps.
Use Extract steps to extract the returned data from the application tree as usual.
Properties
Configure the Query Database step using the following properties.
- Database Mapping
- Select a database mapping from the mappings specified in the Call Robot step.
- SQL Statement
- Type a SQL statement to execute on the selected database, such as
select * from departments;.
The robot does not evaluate the statement you type. Check your SQL statements beforehand or you can check the validity of the statement just by executing the step.
- Application name
- Set the name of the application the step opens. The name specified in this required parameter is used in the
application's
name and
title attributes.
Assign different application names to applications in a robot to avoid errors.
- Iteration Variable (optional)
- Specify a variable to store iteration data.
Component actions
The columns of long binary (BLOB) and long text (CLOB) database types are not read into the application tree. Instead, you should use the Read Long Binary Value or Read Long Text Value component actions, respectively, to read the values from columns of these types. These actions let you specify a variable to read the long data to and a flag indicating whether the robot should throw an exception if the NULL data is read. This flag is off by default indicating that the NULL data treated as empty data.