Oracle expects SQL like the following to compare dates.
MODIFIED_DATE > TO_DATE('2003-07-17','yyyy-mm-dd')
You either need to use that in your exp() method, or use greaterExp(),
which can automatically generate the needed sql for the current database.
Date date = new GregorianCalendar(2003, Calendar.JULY,
17).getTime() ;
Expression matchDateGreaterThanDate1 =
ExpressionFactory.greaterExp("MODIFIED_DATE", date);
On Sat, Jan 2, 2021 at 3:45 AM Andrea Biasillo <[email protected]> wrote:
> Hi!
>
> Is it possible to use Date values in ExpressionFactory.exp?
>
> This works very well:
>
> Expression exp = ExpressionFactory.exp("businessPartnerName='andrea' and
> businessPartnerCode!='rossi' or ((businessPartnerCode!='bianchi' and
> maxAdvancePaymentPercent>9) or businessPartnerCode!='pippo' or
> (maxAdvancePaymentPercent>100 or maxAdvancePaymentPercent<10))");
>
> but if I use a Date value like this:
>
> Expression expDate = ExpressionFactory.exp("modifiedDate> '2003-07-17'");
>
> The database, Oracle in my case, will complain:
>
> Literal does not match format string
> (the database expects something like this: MODIFIED_DATE > DATE
> '2003-07-17')
>
> Any input?
>
> Andrea
>
>
>
>
>
>