I am trying to create a function for my MariaDB using XAMPP:
create definer = root@localhost
function sunshine.get_next_gid() returns int
BEGIN
DECLARE next_val int;
update sunshine.gid_seq set gid = gid + 1;
select gid into next_val from sunshine.gid_seq;
return next_val;
END;
I keep getting an error for the DECLARE: MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 4
What am I doing wrong?