Oracle字段根據逗號分割查詢數據

需求是表裏的某個字段存儲的值是以逗號分隔開來的,要求根據分隔的每個值都能查出來數據,可是不能使用like查詢。html

數據是這樣的:sql

查詢的sql以下:dom

select * from (
    select guid, regexp_substr(st_responsible, '[^,]+', 1, level) responsible 
        from tt_cancle_responsible 
        connect by level <= regexp_count(st_responsible, ',') + 1
        and guid = prior guid
        and prior dbms_random.value is not null )
where responsible ='wyy';

 查詢結果以下:post

相關文章
相關標籤/搜索