我的光标仅在表中插入空值。在select子句中,我曾提到忽略空值,但它忽略了其他值并仅插入空值。
CREATE ` PROCEDURE `History`()
BEGIN
DECLARE done INT DEFAULT 0;
Declare ProductName VARCHAR(40);
DECLARE cur1 CURSOR FOR select
ProductName from products where ProductName is not null ;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur1;
FETCH cur1 INTO ProductName ;
INSERT INTO productdummy values ( ProductName );
CLOSE cur1;
END