Is there a combination of “LIKE” and “IN” in SQL?

后端 未结 25 1921
灰色年华
灰色年华 2020-11-22 03:08

In SQL I (sadly) often have to use \"LIKE\" conditions due to databases that violate nearly every rule of normalization. I can\'t change that right now. But tha

25条回答
  •  醉梦人生
    2020-11-22 03:38

    In Oracle you can use a collection in the following way:

    WHERE EXISTS (SELECT 1
                    FROM TABLE(ku$_vcnt('bla%', '%foo%', 'batz%'))
                   WHERE something LIKE column_value)
    

    Here I have used a predefined collection type ku$_vcnt, but you can declare your own one like this:

    CREATE TYPE my_collection AS TABLE OF VARCHAR2(4000);
    

提交回复
热议问题