mysql存储过程

CREATE DEFINER = `page_visitor_record` @`%` PROCEDURE `addTestData` () BEGIN
    DECLARE
        number INT;
    
    SET number = 1;
    WHILE
            number <= 100 #插入N条数据
        DO
            UPDATE browse_statis_record 
            SET staff_id = staff_id + id,
            staff_name = CONCAT( 'zhangsan(张三', id, ')' ) 
        WHERE
            id IN ( SELECT t.id FROM ( SELECT * FROM browse_statis_record WHERE id > 480 AND staff_id = 323280LIMIT 10 ) AS t );
        
        SET number = number + 1;
        
    END WHILE;

END

 

posted @ 2022-12-12 09:41  韩梦芫  阅读(11)  评论(0编辑  收藏  举报