CREATE PROCEDURE sp_split(in words varchar(2000),in regex varchar(20)) BEGIN CREATE TEMPORARY TABLE IF NOT EXISTS temp_key_split ( key_words varchar(20) ); DELETE FROM temp_key_split; while(instr(words,regex)0) DO INSERT temp_key_split(key_words) VALUES (substring(words,1,instr(words,regex)-1)); set words = INSERT(words,1,instr(words,regex),''); END WHILE; INSERT temp_key_split(key_words) VALUES (words); END;
MyBatis中操作存储过程
<select id="callStoredProcedure" parameterType="pd" statementType="CALLABLE"> call sp_split(( SELECT GROUP_CONCAT(seo_keywords) FROM shopping_goods WHERE seo_keywords LIKE CONCAT(CONCAT('%', #{goods_key}),'%') ), ','); </select>
![weinxin](https://img.cncrq.com/2020/12/20201205105502610.png)
我的微信
这是我的微信扫一扫
评论