Statement incomplete in mysql

22 Views Asked by At

Im having trouble creating a function in mySql where it is throwing errors.

-- Function to calculate due date --
create function calc_due_date(checkout_date datetime)
returns datetime
begin
    declare due_date datetime;
    set due_date = checkout_date + interval 15 day;
    return due_date;
end;

['return is not valid at this position'](https://i.stack.imgur.com/a80Xh.png)

I am making a function to take checkout_date as an input and return due_date which is 15 days after the checkout_date

0

There are 0 best solutions below