1
BEGIN
2
SET @sql := CONCAT('DROP TEMPORARY TABLE IF EXISTS ', outputTable);
3
PREPARE stmt FROM @sql;
4
EXECUTE stmt;
5
DEALLOCATE PREPARE stmt;
6
# Creating table
7
SET @sql := CONCAT('CREATE TEMPORARY TABLE ', outputTable, ' (`myKey` INT,INDEX tpk(`myKey`)) ENGINE=MEMORY;');
8
PREPARE stmt FROM @sql;
9
EXECUTE stmt;
10
DEALLOCATE PREPARE stmt;
11
IF toSplit IS NOT NULL THEN
12
# Preparing toSplit
13
SET @vars := toSplit;
14
SET @vars := CONCAT("('", REPLACE(@vars, ",", "'),('"), "')");
15
# Inserting values
16
SET @sql := CONCAT('INSERT IGNORE INTO ', outputTable, ' VALUES ', @vars);
17
PREPARE stmt FROM @sql;
18
EXECUTE stmt;
19
DEALLOCATE PREPARE stmt;
20
END IF;
21
END