Skip to content

Instantly share code, notes, and snippets.

@youzipi
Created August 6, 2016 07:48
Show Gist options
  • Save youzipi/a58a7d60db1b21267a831619bd0ef18e to your computer and use it in GitHub Desktop.
Save youzipi/a58a7d60db1b21267a831619bd0ef18e to your computer and use it in GitHub Desktop.
构造测试数据
DROP PROCEDURE IF EXISTS build_test_data;
DELIMITER #
CREATE PROCEDURE build_test_data()
BEGIN
DECLARE v_max INT UNSIGNED DEFAULT 20;
DECLARE v_counter INT UNSIGNED DEFAULT 0;
START TRANSACTION;
WHILE v_counter < v_max DO
INSERT INTO `np_customer_coin` (`customer_id`, `detail`, `type`, `coin`, `create_time`, `modified_time`, `create_user`)
VALUES
(2278, '12', '1', v_counter, '2016-07-28 13:46:37', '0000-00-00 00:00:00', 'admin');
SET v_counter = v_counter + 1;
END WHILE;
COMMIT;
END #
DELIMITER ;
CALL build_test_data();
SELECT *
FROM np_customer_coin
ORDER BY id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment