Is it possible to generate an arbitrary value where it computes the SQL query through the Jdbc template:
Example:
If I pass the value for 1 parameter (name only): search by name
"select * from address where shopname = ?";
If I pass the value for 2 parameters (name and city) - search by store name and city:
"select * from address where shopname = ? and city = ?";
I have mupliple search fields. 7 fields. If the user enters any combination. I have a search only by parameter. How to dynamically pass parameters in sql. Need a snippet / An example of how to do this.
minil
source share