I have a use-case of getting the records based on the active flag in Postgres db.
In the rest api,
- If active param is passed as active=true, get the active records
- If active param is passed as active=false get the inactive records
- If active param is not passed get both the records
In api the 'active' flag as Boolean class. Using native query for querying, but unable to form the query
select * from records r where r.country='India' and (IF(active IS NULL ) BEGIN '' END ELSE BEGIN r.active = :active END)
But query is failing..