Developing Apama Applications > Developing Apama Applications in EPL > Defining Queries > Implementing parameterized queries > Format for defining query parameters
Format for defining query parameters
You define query parameters in the parameters section of a query definition. The parameters section is optional. If you specify a parameters section it must be the first section in the query. The format for specifying the parameters section is as follows:
parameters {
data_type parameter_name;
[ data_type parameter_name; ]...
}
Parameters must be integer, float, string or boolean types. Specify one or more data_type parameter_name pairs. The parameter name can use any of the characters allowed for EPL Identifiers. Any parameters you specify are available throughout the rest of the query.
In the following example, the parameters section is in bold as are the references to the parameters.
query FaultyProduct {
   parameters {
      string product;
      float thresholdCost;
      float warrantyPeriod;
   }

inputs {
Sale() key customerId within warrantyPeriod;
Repair() key customerId retain 1;
}
find Sale():s1 -> Repair():r1
where s1.product = product
and r1.product = product
and r1.cost >= thresholdCost
{
log "Cost of warranty covered repair for product \"" + product +
"! above threshold $" + thresholdCost.toString() + " by $
" + (r1.cost - thresholdCost).toString() at INFO;
}
}
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.