DATE_ADD functionality in Ingres

Many (most? Almost all?) SQL dialects have a way to execute this type of function: date_add (MyDate, MyInterval)

I went through all the documents, but I can not find this function in Ingres. My immediate goal is to get "MyDate plus 3 months." Does anyone know if there is an easy way to do this that I am missing?

Note. I understand that it is possible to achieve this using existing SQL. But this will include:

  • extract the month from my date
  • add 3 to this number
  • extract the day and year from my date.
  • use a new day, month, year to create a new date.
  • But I also need to check if I do not cross the border of the year, so there will also be a CASE statement

It's an awful lot of SQL for something so simple in Oracle, MySQL, PostgreSQL, SQL Server and all the rest that I can think of. This makes me hope that I somehow lack a simpler alternative.

+4
source share
1 answer

I have no link. Find your documentation for date arithmetic and / or interval data type.

Here is an example that is no different from your English statement of what you want:

DATE('23-oct-09') + '3 months' 
+6
source

All Articles