日期:2014-05-16 浏览次数:20805 次
mysql> delimiter // mysql> mysql> create procedure p1() -> BEGIN -> DECLARE v INT; -> SET @uuid1 = UUID(); -> SET v=0; -> WHILE v<2 DO -> INSERT INTO t1 values (id1,@uuid1); -- ACMAIN values ! -> SET v= v+1; -> END WHILE; -> END; -> // Query OK, 0 rows affected (0.00 sec) mysql> delimiter ; mysql>
------解决方案--------------------
DELIMITER $$
DROP PROCEDURE IF EXISTS ddt$$
CREATE PROCEDURE `testa`.`ddt`()
BEGIN
DECLARE v INTEGER;
SET @uuid1=UUID();
SET v=0;
WHILE v<2 DO
INSERT INTO t1 VALUES(id1,@uuid1);
SET v= v+1;
END WHILE;
END$$
DELIMITER ;
------解决方案--------------------
SET @uuid1 = UUID(); @uuid2 = UUID();@uuid3 = UUID(); @uuid4 = UUID();@uuid5 = UUID(); @uuid6 = UUID();@uuid7 = UUID(); @uuid8 = UUID();@uuid9 = UUID(); @uuid10 = UUID();@uuid11 = UUID();@uuid12 = UUID();@uuid13 = UUID();@uuid14 = UUID();@uuid15 = UUID();@uuid16 = UUID();@uuid17= UUID();@uuid18 = UUID();@uuid19 = UUID();@uuid20 = UUID();
分号改成逗号!
mysql> set @x=1,@y=2;
Query OK, 0 rows affected (0.00 sec)