存储过程中如何实现从数组获取数据
SET @array_content="6,6,41,43 12,12,43,45 1,1,41,45";
#获取数组长度
SET @count=CHAR_LENGTH(@array_content)-CHAR_LENGTH(REPLACE(@array_content,' ','')) + 1;
#一维数组下标
SET @i=1 + FLOOR(RAND() * 3);
#二维数组下标
SET @j=1 + FLOOR(RAND() * 4);
set @randData = SUBSTRING_INDEX(SUBSTRING_INDEX(@array_content,' ',@i),' ',-1);
select SUBSTRING_INDEX(SUBSTRING_INDEX(@randData,',',@j),',',-1)