Search code examples
gemfire

how to write a case statement like sql in pivotal gemfire query


Sample sql query:

select name,  
lastname,  
city, 
case when city='Mumbai' then '01' else '02' end as Code 
from products

How to write above query in pivotal gemfire using case statement?


Solution

  • This is currently not supported when using native OQL, you need to implement the use case using another approach, like executing a function that filters the results directly on server side before returning the objects. More details about this can be found in Function Execution.

    That said, there's already an improvement request created for this functionality, you can follow the progress by adding yourself as a watcher to GEODE-4040.

    Hope this helps. Cheers.