List of Predefined Date Literals - Firebird

A number of date literals, single-quoted strings that Firebird SQL will accept in lieu of certain special dates, are available to both dialect 1 and dialect 3 databases. In dialect 1, the strings can be used directly; in dialect 3, they must be cast to type. Table shows the usage in each dialect.

List of Predefined Date Literals

List of Predefined Date Literals

Examples Using Pre-Defined Date Literals

In a dialect 1 database, this statement returns exact server time:

SELECT 'NOW' AS TIME_FINISHED FROM RDB$DATABASE;

In a dialect 3 database, the date literal must be cast as a TIMESTAMP type:

SELECT CAST('NOW' AS TIMESTAMP) AS TIME_FINISHED FROM RDB$DATABASE;

This UPDATE statement sets a date column to server time plus one day in dialect 1:

UPDATE TABLE_A SET UPDATE_DATE = 'TOMORROW' WHERE KEY_ID = 144;

Here’s the same operation in dialect 3, with casting:

UPDATE TABLE_A SET UPDATE_DATE = CAST('TOMORROW' AS DATE) WHERE KEY_ID = 144;

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Firebird Topics