5

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.

caRameL
  • 633
  • 6
  • 15

1 Answers1

8

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;