知识积累,,,,oracle查询带 , 的字符串,将逗号分隔开查询

select * from t_article  where article_channel = '智库动态' and tagname = '4G+,人工智能';

以上是未按","分开时的查询

SELECT
    article_id,
    article_channel,
    article_content,
    article_title,
    REGEXP_SUBSTR (tagname, '[^,]+', 1, lv) tagname
FROM
    t_article,
    (
        SELECT
            LEVEL lv
        FROM
            dual CONNECT BY LEVEL < 4
    ) b
WHERE
    b.lv <= REGEXP_COUNT (t_article.tagname, '\,') + 1  and article_channel = '智库动态' and tagname = '4G+,人工智能'
ORDER BY
    article_id;

以上是按","分开后的查询

猜你喜欢

转载自blog.csdn.net/qq_23034755/article/details/81279231