Add days to date in SAP HANA stored procedure

user4836066 picture user4836066 · Apr 28, 2016 · Viewed 7.3k times · Source

I need to add days to date in HANA stored procedure, but I am getting error message

ERROR WHILE parsing DATE/ TIME

I use this statement where p_end_date is parameter of my stored procedure.

v_end_date_plus := add_days (TO_DATE(' || p_end_date || ' , 'YYYY-MM-DD' ), 90)

Is there is any other way or what I am doing wrong in it ?

Answer

Lars Br. picture Lars Br. · Apr 29, 2016

Even though you didn't post what error you receive, I guess that the problem in your code is the way you referenced your input variable.

v_end_date_plus := add_days ( :p_end_date , 90);

With the colon (:) in front of the parameter you should be able to use it without having to cast it into a different data type.