I have the following code made from when my database was HSQLDB:
SELECT
"Item",
DATEDIFF('DAY', CURRENT_DATE, "Expiry") AS "Days Remaining"
FROM "Expirations"
The date values in the Expiry
column are in the YY-MM-DD
format.
After Libreoffice Base threw up a message about how it plans to eventually migrate to Firebird, I accepted the migration on a backup, which now causes the above query to throw up the following error:
firebird_sdbc error:
*Dynamic SQL Error
*SQL error code = -104
*Token unknown - line 1, column 26
*'DAY'
caused by
'isc_dsql_prepare'
at ./connectivity/source/drivers/firebird/Util.cxx:69
I only just started getting comfortable with the basics of HSQLDB, so I'm now trying to pour through the Firebird documentation to understand what the issue is.
The documentation states the correct syntax is:
DATEDIFF (<args>)
<args> ::=
<unit> FROM <moment1> TO <moment2>
| <unit>, <moment1>, <moment2>
<unit> ::=
YEAR | MONTH | WEEK | DAY
| HOUR | MINUTE | SECOND | MILLISECOND
<momentN> ::= a DATE, TIME or TIMESTAMP expression
DAY
on its own throws up a syntax error, so I have to use 'DAY'
. That wasn't the issue, so I'm not sure why it's having an issue with that aspect of the arguments. The Expiry
column in that table was created as a date, and I would assume CURRENT_DATE
is also a date.
What am I missing?