Nested queries help you to use the result of one query as an input parameter of another, and the queries executed in a nested query works in a transactional manner. The steps below show how to add a nested query to a data service:
- First ,add the query with an input parameter, which is evaluated as the result of another query. In this example, the
customerNumberinput mapping is the result of another query.
- Next, add the query
customerOrderSQL,which generates the
- Select Add New Output Mapping option of the above query, and define the mappings as follows:
In this case, the mapping type is
query. It allows you to select the query name and define query parameter mapping. As shown below, the query
customerNameSQLis invoked with
customerNumberparameter, which is a result of
Invoking the query
- In order to test the nested query, add an operation to the query
- When the operation is invoked, results contain the nested result element
Customer, which returns from
- In the configuration syntax, you can define the
call-queryelement as a result of a query as follows:
Description of the child elements and attributes of the call-query are as follows.
- call-query/@href : Name of the nested query
- call-query/with-param : Define the input parameter to be passed to nested query
- call-query/with-param/@name : name of the parameter as defined in the nested query
- call-query/with-param/@query-param : name of the parameter as returned from this query
- call-query/with-param/@column : name of the parameter as returned from the immediate parent result element
call-query/with-param/@columnattributes, only one is used in a single
Also see Nested Query Sample for a demonstration of how nested queries work.