SELECT * FROM Table1 WHERE
Table1.PRODUCT LIKE ( select regexp_substr(I_PRODUCT,'[^,]+', 1, level) from dual
connect by regexp_substr(I_PRODUCT, '[^,]+', 1, level) is not null);
LIKE operatør ville mislykkes i ovenstående forespørgsel. Du skal bruge IN , som internt ville blive evalueret som flere ELLER .
Table1.PRODUCT IN ( select regexp_substr(I_PRODUCT,'[^,]+', 1, level) from dual
connect by regexp_substr(I_PRODUCT, '[^,]+', 1, level) is not null);
Også vedrørende varierende IN-liste , se mit svar her .
Opdater
Baseret på OPs kommentarer.
Rediger forespørgslen som:
WITH str_search AS
(
select regexp_substr(I_PRODUCT,'[^,]+', 1, level) pattern from dual
connect by regexp_substr(I_PRODUCT, '[^,]+', 1, level) is not null
)
SELECT *
FROM Table1
WHERE EXISTS (
SELECT NULL
FROM str_search
WHERE tab.col LIKE pattern
);