1

我有两种代码提供输入,例如','分隔符和单独的项目(例如:输入:'1,2,3' 输出:1 和 2 和 3),第一种是:

LABLE: LOOP
    SET a = a + 1;
    IF a <= p_count THEN 
        SET remainder = SUBSTRING_INDEX(input ,',',a);
        SET remainder = SUBSTRING_INDEX(remainder,',',-1);
                SELECT remainder;
        ITERATE LABLE;
    END IF;
    LEAVE LABLE;
END LOOP LABLE;

第二个是:

 SET remainder = input;
 SET delimiter_length = LENGTH(delimiter);
 WHILE LENGTH(remainder) > 0 AND cur_position > 0 DO
         SET cur_position = INSTR(remainder, delimiter);
         IF cur_position = 0 THEN
            SET cur_string = remainder;
         ELSE
            SET cur_string = LEFT(remainder, cur_position - 1);
         END IF;
         SELECT cur_string;
         SET remainder = SUBSTRING(remainder, cur_position + delimiter_length);
 END WHILE; 

现在,我想知道它们中的哪一个在大数据中更好,我的意思是它们中的哪一个具有较低的过载?

4

0 回答 0