DELIMITER // CREATE PROCEDURE proc(IN s1 VARCHAR(32), IN s2 VARCHAR(32), OUT o INT) BEGIN DECLARE a INT; SELECT COUNT(*) INTO a FROM TBL WHERE COL1=s1 AND COL2=s2; IF a = 0 THEN SET o = 0; ELSE SET o = 1; END IF; END // DELIMITER ;
CALL proc('SUZUKI','ICHIRO',@a) SELECT @a
未だにそうなのでビューを使う