s.paskevics Posted December 12, 2014 Share Posted December 12, 2014 My query:SELECT name FROM test_table WHERE test_column_name LIKE ($P{PARAM_VALUE} == null ? "%" : $P{PARAM_VALUE})[/code]what I did wrong? Link to comment Share on other sites More sharing options...
nthapa Posted December 12, 2014 Share Posted December 12, 2014 NA Link to comment Share on other sites More sharing options...
Solution nthapa Posted December 12, 2014 Solution Share Posted December 12, 2014 Can you see if any of the following this makes difference?SELECT name FROM test_table WHERE test_column_name LIKE ($P{PARAM_VALUE} IS NULL ? "%" : $P{PARAM_VALUE}) SELECT name FROM test_table WHERE (test_column_name LIKE $P{PARAM_VALUE} and $P{PARAM_VALUE} IS NOT NULL ) or (test_column_name LIKE "%" and $P{PARAM_VALUE}) IS NULL) Link to comment Share on other sites More sharing options...
james.t Posted December 13, 2014 Share Posted December 13, 2014 This part of your query is actually Java code:($P{PARAM_VALUE} == NULL ? "%" : $P{PARAM_VALUE})so it won't work. You can't mix Java and SQL in a query. 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