jainpran Posted March 12, 2008 Share Posted March 12, 2008 Hi, I want to dynamically pass where cluase to the query. Situation is, I have written query in jrxml file like this: select empId, empNamefrom emp I want to dynamically build where clause depending on what user has entered as search parameters. It can be either empId or empName or both. So final query can be: select empId, empNamefrom empwhere empId = 1 OR select empId, empNamefrom empwhere empName LIKE '%ab%' OR select empId, empNamefrom empwhere empId = 1and empName LIKE '%ab%' Can you please tell me how to create such where clause (passing it as parameter)? Link to comment Share on other sites More sharing options...
Pedja Posted March 12, 2008 Share Posted March 12, 2008 You can do this by setting the query to select empId, empNamefrom empwhere $P!{WHERE_PARAM} and then putting what you want in WHERE_PARAM. Link to comment Share on other sites More sharing options...
jainpran Posted March 12, 2008 Author Share Posted March 12, 2008 thanx..:) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now