caRameL
caRameL

Reputation: 633

Add Interval to date in HSQLDB

How can i add for example 1 month to a date (already in the db) in a HSQL database.

In MySQL it would be :

UPDATE TABLE_CA SET DATE_A = DATE_ADD(DATE_A, INTERVAL 1 MONTH) WHERE id = 45

This function is supposed to work in HSQL but i got the following error :

Object not found : DATE_ADD

I'm using hsqldb 2.2.6 and cannot find the way to do this. I also tried DATEADD() function with the same result.

Upvotes: 5

Views: 5115

Answers (1)

user330315
user330315

Reputation:

No need to call a function, HSQLDB supports SQL standard interval literals.

UPDATE TABLE_CA 
    SET DATE_A = DATE_A + INTERVAL '1' MONTH
WHERE id = 45;

Upvotes: 8

Related Questions