I am new in jooq So i want to write this below query in jooq .
"CASE len(CAST(SUBSTRING(attachedblob, 1, 1) AS varchar(1))) when 1 then 'true' else 'false' end ReviewExistance "
Can you tell me please .
Thanks
For completeness' sake, here's how your SQL expression could translate to jOOQ:
// Assuming a static import:
import static org.jooq.impl.DSL.*;
import static org.jooq.impl.SQLDataTypes.*;
decode().value(
length(
cast(
substring(MY_TABLE.ATTACHEDBLOB, 1, 1),
VARCHAR.length(1)
)
)
)
.when(1, "true")
.otherwise("false")
.as("ReviewExistance");
If that's too nasty, you can always resort to plain SQL. Examples are given here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With