This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


In a data service, sometimes the result of one query may be used as an input parameter for another query. In such situations, we use the nested query feature available in the WSO2 Enterprise Integrator (WSO2 EI).


The sample data service (NestedQuerySample) contains the following operations:

  • employeesInOffice - : The employeesInOfficeSQL query takes in an office code and prints the details of all the employess employees in that office.
  • listOffices - : The listOfficesSQL query lists all the offices in the database. When office information is printed, all the employees that belong to an office are also printed using a nested query, which refers to the employeesInOfficeSQL query, which is invoked by the "employeesInOffice" operation.
  • customerNameSQL - The customerNameSQL query takes in the customer number as a parameter and returns the customer name. In the result section of this query, there is no "rowName" defined (only an element wrapper). With this option, a separate element will not be created for every record in the result. However, the record content will be directly added to the outer element. This is best used in a query where there is only one record to be returned.
  • customerOrders - The customerOrdersSQL query prints the details of all the orders that are in the database. In the result elements, a nested query which references the customerNameSQL query is used. In this way, the name of the customer who placed the order can also be returned with the order details.