Subject Re: [firebird-support] Re: expression evaluation not supported
Author Paul Vinkenoog
Jonathan wrote:

> Sorry you are forced to use something as great as Firebird :-). I assume LAST_MODIFIED_ON is a TIMESTAMP field in your table and is being updated via a trigger or some other mechanism as records are modified. Your DATEDIFF syntax is incorrect; try:
>
> ... WHERE LICENSE_PLATE_NO<>'No plate found' AND DATEDIFF(second,LAST_MODIFIED_ON,current_timestamp)<120
>
> or
>
> ... WHERE LICENSE_PLATE_NO<>'No plate found' AND DATEDIFF(minute,LAST_MODIFIED_ON,current_timestamp)<2

This should work, but it's not Jupiter's syntax that was incorrect. The FROM .. TO syntax is fully supported. Point is, you're not allowed to mix TIME and TIMESTAMP arguments with DATEDIFF (DATE and TIMESTAMP is OK though). So, since LAST_MODIFIED_ON is obviously a TIMESTAMP, current_time should be current_timestamp - as in your corrected example.

http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-intfunc-datediff.html


Cheers,
Paul Vinkenoog