In an H2 database on a column of type TIMESTAMP how do I run a query
SELECT * FROM RECORDS WHERE TRAN_DATE < '2012/07/24'
This can be easily done using equals to(=), less than(<), and greater than(>) operators. In SQL, the date value has DATE datatype which accepts date in 'yyyy-mm-dd' format. To compare two dates, we will declare two dates and compare them using the IF-ELSE statement.
The format is hh:mm:ss[. nnnnnnnnn].
MySQL has the ability to compare two different dates written as a string expression. When you need to compare dates between a date column and an arbitrary date, you can use the DATE() function to extract the date part from your column and compare it with a string that represents your desired date.
And when inserting an empty string in H2 with MODE=Oracle it is not converted to NULL whereas in Oracle DB NULL is stored and not an empty string.
Try '2012-07-24'
http://www.h2database.com/html/grammar.html?highlight=dateType&search=date#date
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