I'm working on DB2 stored procedure, which will be called by the Korn Shell (.ksh). My DB2 version is 11.5 and it is running on AIX.
I was stuck in TIMESTAMP to DATE conversion. Below is my requirement.
If s_day < day(s_date) then
start_date = YYYY-MM from s_date + 1 day from s_day
end if
Note here
s_date
is DATE variable, s_day
is CHAR variable and start_date
is DATE variable.
So I tried, the following code, but got an error.
IF s_day < DAY(s_date)
THEN
SET start_date = DATE (DATE(s_date,'YYYY-MM') || s_day + 1);
END IF
Sample values
s_day =03
s_date= 15/05/2020
expected output start_date is 2020-05-04
Can anyone help me to achieve expected output?
Asked by looty
(1 rep)
May 14, 2020, 07:18 PM
Last activity: May 15, 2020, 12:39 PM
Last activity: May 15, 2020, 12:39 PM