mysql - SQL Stored Procedure Syntax error missing 'end' -
i've been working on sql stored procedure , new process. i'm trying write procedure retrieves value 1 table , inserts part of new row. i'm using mysql workbench, , it's giving me error @ line where blockid = blk; as part of following code: create definer=`root`@`localhost` procedure `add_userblock`(in user int(11), in blk int(11)) begin -- determine how many blocks can add declare blocknum int default -1; select addcount blocknum block blockid = blk; -- determine if block exists user declare entryexists int default 0; select count(*) entryexists userblock blockid = blk , userid = user; if (entryexists = 0) -- new entry begin insert userblock (userid, blockid, num) values (user, blk, blocknum); select last_insert_id() 'id'; end else -- existing entry begin update userblock set num = (num + blocknum)