Re: Proper way of using expr in complicated queries
Hi!
Sorry for the late reply...
The INTERVAL isn't supported... that's why it fails when using table().where();
Solution is to use the general Session.sql();
There you can pass arguments using ? (named binds are not possible).
So your query would be:
auto sql = session.sql("SELECT * FROM table
WHERE column1 IS NULL OR (column2 is NULL AND DATE_SUB(NOW(), INTERVAL ? SECOND) > column1);");
then to execute:
auto result = sql.bind(10).execute();
Hope it hepls.
Cheers,
Luís
Subject
Views
Written By
Posted
631
April 13, 2022 05:53AM
Re: Proper way of using expr in complicated queries
316
May 17, 2022 08:53AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.