mysql if exist坑

TOP:BEGIN
    #Routine body goes here...

    IF EXISTS
    (
        SELECT * FROM `user` WHERE `name` = in_user_name
    ) THEN
            SELECT -1 AS RET;
            LEAVE TOP;
    END IF;
  UPDATE `user` SET `name` = in_user_name WHERE `user_id` = in_user_id;
    SELECT 0 AS RET;
END

if exists里面的sql后面不能加分号;这个也太坑了吧

posted @ 2015-09-29 11:13  zzyoucan  阅读(5938)  评论(0编辑  收藏  举报