How to compare a comma seperated value in a column with a string collection in Oracle?

Use Instr() to find the comma in your parameter Use Substr() to pick the text from the left and right side of your parameter. E. G: Substr('john,smith',1,instr('john,smith',',')-1) to give you 'john' Substr('john,smith',instr('john,smith',',') to give you 'smith And then just put those returns into your WHERE clause Where 'john' in(name_repository) OR 'smith in(name_repository) OR...just write your own split function... :-).

Use Instr() to find the comma in your parameter Use Substr() to pick the text from the left and right side of your parameter. E. G: Substr('john,smith',1,instr('john,smith',',')-1) to give you 'john' Substr('john,smith',instr('john,smith',',') to give you 'smith' And then just put those returns into your WHERE clause Where 'john' in(name_repository) OR 'smith in(name_repository) OR...just write your own split function... :-).

I haven't tried other answers but this was quickest and neat – gizgok Aug 2 at 12:08.

You could split the names like this: SELECT REGEXP_SUBSTR ( name, '^,+', 1, LEVEL) data FROM table CONNECT BY LEVEL.

Look at the following link: link It seems a compact solution could be the following: SQL> SELECT str 2 , REGEXP_SUBSTR(str, '^,+', 1, LEVEL) AS single_element 3 , LEVEL AS element_no 4 FROM ( 5 SELECT ROWNUM AS id 6 , str 7 FROM t 8 ) 9 CONNECT BY INSTR(str, ',', 1, LEVEL-1) > 0 10 AND id = PRIOR id 11 AND PRIOR DBMS_RANDOM. VALUE IS NOT NULL; STR SINGLE_ELEMENT ELEMENT_NO ------------------------------ ------------------------------ ---------- X,Y,Z X 1 X,Y,Z Y 2 X,Y,Z Z 3 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG XXX 1 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG Y 2 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG ZZ 3 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG AAAAA 4 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG B 5 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG CCC 6 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG D 7 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG E 8 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG F 9 XXX,Y,ZZ,AAAAA,B,CCC,D,E,F,GGG GGG 10 13 rows selected. Note that the in-line view is required to alias ROWNUM (as it cannot be used directly in the PRIOR clause on line 10).

A simple one might be: select * from table where regexp_replace(name,'^. *,','') in name_repository or regexp_replace(name,',. *'') in name_repository; The first regexp zaps the first name from the string, the second one the second name.

I have comma separated values for a column in a table. Be compared with a static value. How should this be done in oracle sql.

This column has a value of ENG,CHI,IND,YUI. And further code based on the true/false result from above comparision.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions