Compare value in a procedure
DELIMITER $$ CREATE PROCEDURE DIFFERENCE(IN P1 INTEGER,IN P2 INTEGER,OUT P3 INTEGER) BEGIN IF P1 > P2 THEN SET P3 = 1; ELSEIF P1 = P2 THEN SET P3 = 2; ELSE SET P3 = 3; END IF; END$$ DELIMITER ;