Subject | iif and coalesce |
---|---|
Author | checkmail |
Post date | 2014-01-14T09:33:05Z |
Hello,
I would like to use dynamic conditions without an statement like:
Condition customer can be 0 (all costomers) or inherits a number of a customer
This doesn’t work: select * from table where iif(:input_customer_id <> 0;’customer_id = ‘ || :input_customer_id,’’)
I can set the input_customer_id to null when its value = 0, perhaps can I realize this with coalesce?
Where customer_id = coalesce(:input_customer_id;’…’) But I can’t set = and > 0 at the same time or = coalesce(..) and not null.
How can I finish my plan? Also I don’t like to set some if-statements… if input = 0 etc., there many inputs.
Thank you.
Best regards.
Olaf