I have a mysql stored procedure which is giving me the following error:-
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set intoffer = 'select max(offerid) from home' if(intoffer IS NULL) then set int' at line 4
I have set the delimiter in the delimiter box as ;.The stored procedure is
create procedure sp()
begin
declare intoffer int
set intoffer = 'select max(offerid) from home'
if(intoffer IS NULL) then
set intoffer=1
else
set intoffer=intoffer+1
insert into home(offerid,offerheader,offertext,offerimage,offerlink) values(intoffer,'d','d','d','d')
end;