我是mysql存储过程的新手。我在以下代码中遇到问题,其中前两个插入查询连续执行并在单次触发时插入高达 2100 的数据。需要一些帮助。
use database;
DELIMITER $$
CREATE PROCEDURE writer(
IN timegenerated DATETIME,
IN timereported DATETIME,
IN syslogfacility smallint(6),
IN syslogpriority smallint(6),
IN HOSTNAME VARCHAR(255),
IN tag VARCHAR(255),
IN msg2 VARCHAR(255),
IN msg3 VARCHAR(255),
IN msg4 INT(11),
IN msg5 VARCHAR(255),
IN msg6 VARCHAR(255),
IN msg7 VARCHAR(255),
IN msg8 VARCHAR(255),
IN msg9 VARCHAR(255),
IN msg10 VARCHAR(255),
IN msg11 VARCHAR(255),
IN msg12 VARCHAR(255),
IN msg13 VARCHAR(255),
IN msg14 VARCHAR(255),
IN msg15 VARCHAR(255),
IN msg16 VARCHAR(255),
IN msg17 VARCHAR(255),
IN msg18 VARCHAR(255))
BEGIN
INSERT INTO `RAW_DATA` VALUES
( '','',timegenerated,timereported,
syslogfacility,syslogpriority,HOSTNAME,tag,
msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,
@site_name,msg11,msg12,msg13,msg14,
msg15,msg16,msg17,msg18,''
);
INSERT INTO `SORTED_DATA` values(msg10,msg7,100)
on duplicate key update hits=hits+1;
IF (msg14=0) THEN
INSERT INTO `UNCATEGORIZED_DATA`(`col1`, `col2`) VALUES (msg10,24);
ELSE
INSERT INTO `CATEGORIZED_DATA`(`col1`, `col2`) VALUES (msg10,25);
END IF;
END$$
DELIMITER ;
试图分离数据并将其存储在不同的表中。