存储过程实例
BEGIN
DECLARE orderPayId INT;
DECLARE orderId INT;
DECLARE cur CURSOR FOR SELECT order_pay_id,order_id FROM tt_mss_pay_info WHERE id >= 114659;
OPEN CUR;
read_loop: LOOP
SET DONE := DONE + 1;
IF DONE > order_id_NUM THEN
LEAVE read_loop;
ELSE
FETCH cur INTO orderPayId,orderId;
INSERT INTO `msssit`.`tt_mss_sale_order_send_task` (
`order_pay_id`,
`order_id`,
`version`,
`server_id`,
`send_tm`,
`send_status`,
`send_num`,
`send_remark`,
`create_tm`,
`create_emp`,
`update_tm`,
`update_emp`
)
VALUES (
orderPayId,
orderId,
'1',
'10.202.38.1308080',
SYSDATE(),
'3',
'1',
'',
SYSDATE(),
'system',
SYSDATE(),
'system'
);
END LOOP;
commit;
END