本文中的存儲過程示例
DECLARE at_end INT DEFAULT
DECLARE PIID INTEGER DEFAULT
DECLARE PINT INTEGER DEFAULT
DECLARE not_found CONDITION FOR SQLSTATE
DECLARE c
SELECT IID FROM YH;
DECLARE CONTINUE HANDLER FOR not_found
SET at_end =
OPEN c
SET PCOUNT=
ins_loop:
LOOP
FETCH c
IF at_end <>
LEAVE ins_loop;
END IF;
SET PCOUNT=PCOUNT+
SELECT IID INTO PINT FROM YH WHERE
END LOOP;
From:http://tw.wingwit.com/Article/program/DB2/201311/21926.html