Grettings everyone, im trying to create a stored procedure but it gives me the following error:

1339 Case not found for CASE statement

Here is the code:

BEGIN
	#Routine body goes here...
	CASE @olds
	WHEN 'emp' THEN
		CASE @news
		WHEN 'loc' THEN
			UPDATE equipos SET pe=pe-1,pg=pg+1 WHERE id=@eqloc;
			UPDATE equipos SET pe=pe-1,pp=pp+1 WHERE id=@eqvis;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		WHEN 'vis' THEN
			UPDATE equipos SET pe=pe-1,pg=pg+1 WHERE id=@eqvis;
			UPDATE equipos SET pe=pe-1,pp=pp+1 WHERE id=@eqloc;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		END CASE;
	WHEN 'loc' THEN
		CASE @news
		WHEN 'emp' THEN
			UPDATE equipos SET pe=pe+1,pg=pg-1 WHERE id=@eqloc;
			UPDATE equipos SET pe=pe+1,pp=pp-1 WHERE id=@eqvis;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		WHEN 'vis' THEN
			UPDATE equipos SET pp=pp-1,pg=pg+1 WHERE id=@eqvis;
			UPDATE equipos SET pg=pg-1,pp=pp+1 WHERE id=@eqloc;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		END CASE;
	WHEN 'vis' THEN
		CASE @news
		WHEN 'emp' THEN
			UPDATE equipos SET pe=pe+1,pg=pg-1 WHERE id=@eqvis;
			UPDATE equipos SET pe=pe+1,pp=pp-1 WHERE id=@eqloc;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		WHEN 'loc' THEN
			UPDATE equipos SET pp=pp-1,pg=pg+1 WHERE id=@eqloc;
			UPDATE equipos SET pg=pg-1,pp=pp+1 WHERE id=@eqvis;
			UPDATE partidos SET `eqgan`=@news WHERE id=@mst;
			UPDATE log_partidos SET `status`=@news WHERE `match`=@mst;
		END CASE;
	END CASE;
END

What im doing wrong?
My parameters are those:

IN `mst` varchar(3),IN `olds` varchar(3),IN `news` varchar(3),IN `eqloc` int,IN `eqvis` int

Show the procedure head and how you call the procedure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.