mysql 存储过程例子

DELIMITER $$

CREATE
    /*[DEFINER = { user | CURRENT_USER }]*/
    PROCEDURE `dpx`.`updatedchatroom`(IN p_UID INT ,IN p_updated BIGINT )
    
    BEGIN


    UPDATE im_friend SET updated=p_updated WHERE duid=p_UID;
    UPDATE im_chatroom_user SET updated=p_updated WHERE uid=p_UID;
    UPDATE im_chatroom  INNER JOIN im_chatroom_user ON im_chatroom.`_id`=im_chatroom_user.`chatroomId` SET im_chatroom.updated=p_updated WHERE im_chatroom_user.`uid`=p_UID;     
    END$$

DELIMITER ;

你可能感兴趣的:(mysql)