navicat added to mysql stored procedure (function)

BEGIN
DECLARE i INT default 0;
DECLARE num int default 0;
DECLARE count1 int default 0;
DECLARE count2 int default 0;
DECLARE headerid varchar(50);
DECLARE warehouse varchar(50);
SELECT @num:=COUNT(*) FROM config_header WHERE recordType='EDI_URL';
DELETE FROM config_detail where recordType='EDI_URL';
WHILE i < @num DO
select @headerid:=id,@warehouse:=warehouseCode from config_header WHERE recordType='EDI_URL' limit i,1;
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CSM',@warehouse,'EDI-CSM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CRM',@warehouse,'EDI-CRM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','MDM',@warehouse,'EDI-MDM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','SAPPI',@warehouse,'EDI-SAPPI','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','DCO2C',@warehouse,'EDI-DCO2C','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CEM',@warehouse,'EDI-CEM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','SRM',@warehouse,'EDI-SRM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
SET i = i + 1 ;
SELECT @headerid headerids;
END WHILE ;
END

Guess you like

Origin www.cnblogs.com/joker331/p/11590166.html