Last active
December 14, 2015 20:38
-
-
Save phantom42/5145002 to your computer and use it in GitHub Desktop.
tokenize string to use in oracle WHERE... IN clause. reference: https://blogs.oracle.com/aramamoo/entry/how_to_split_comma_separated_string_and_pass_to_in_clause_of_select_statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- '1,2,3' is the list of ids we would be searching against | |
SELECT * | |
FROM table | |
WHERE id IN | |
( | |
SELECT REGEXP_SUBSTR('1,2,3','[^,]+', 1, level) from dual | |
CONNECT BY REGEXP_SUBSTR('1,2,3', '[^,]+', 1, level) is not null | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment