How do you use coalese with Jooq in numerical expressions?
For example, I want something like .where(TEST_TABLE.NUMBER).eq(5.minus(DSL.coalesce(TEST_TABLE.OTHERNUMBER, 0)))
but minus is expecting an argument of type number (like int double etc.) as an argument and I get “None of the following functions can be called with the arguments supplied.”
If I just have .eq(DSL.coalesce(TEST_TABLE.OTHERNUMBER, 0))
then it works fine. Also, just running it as a Postgres query like WHERE test_table.number = (5 - COALESCE(test_table.othernumber))
works fine. Any suggestions?
I tried adding .cast(SQLDataType.NUMERIC)
but get the same issue.
tc1234 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.