Jump to content
We've recently updated our Privacy Statement, available here ×

Dynamic Where Clause


jainpran

Recommended Posts

Hi,

 

I want to dynamically pass where cluase to the query. Situation is, I have written query in jrxml file like this:

 

select empId, empName

from 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, empName

from emp

where empId = 1

 

OR

 

select empId, empName

from emp

where empName LIKE '%ab%'

 

OR

 

select empId, empName

from emp

where empId = 1

and 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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...