I am using DB2 and writing an SQL query on a table where I have one column for each upcoming month. Like, Jan, Feb, Mar, Apr, May etc. 12 in total.
The data is forecasted sales for the upcoming 12 months. It is recalculated every night.
For example, if the current month is November 2019, the November-column contains the forecast for this November 2019, the December-column for December 2019 etc. But, the January-column has data for January 2020.
How can I, in SQL, get the date of the upcoming month that the column represent?
I need a function like GetNextJanuary(), which returns 20200101 if used this year, and GetNextDecember() which returns 20191201 etc. However, if I would use GetNextJune() today, it should return 20190601 (the current month).
Is this possible using SQL alone?