x
1
BEGIN
2
DECLARE table_name VARCHAR(50) DEFAULT '';
3
DECLARE columns_list VARCHAR(2000) DEFAULT '';
4
DECLARE values_list TEXT DEFAULT '';
5
DECLARE cur_position INT DEFAULT 1;
6
DECLARE cur_string VARCHAR(2000);
7
DECLARE delimiter_length TINYINT UNSIGNED;
8
DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
9
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;
10
11
12
SET cur_position = 1;
13
14
SET delimiter_length = CHAR_LENGTH('||');
15
16
WHILE CHAR_LENGTH(incoming) > 0 AND cur_position > 0 DO
17
SET cur_position = INSTR(incoming, '||');
18
IF cur_position = 0 THEN
19
SET cur_string = incoming;
20
ELSE
21
SET cur_string = LEFT(incoming, cur_position - 1);
22
END IF;
23
24
IF TRIM(cur_string) != '' THEN
25
CALL HVDataInsert(cur_string);
26
END IF;
27
SET incoming = SUBSTRING(incoming, cur_position + delimiter_length);
28
END WHILE;
29
30
31
END