1

Usually when one has to search in oracle for a single where condition where you don't know the exact condition we use :

Select * from Table where column like '%Val%'

If I have to run check for multiple condition we use IN

Select * from Table where column in ('Value1','ABC2')

How we combine the two ?i.e , search for a bunch of values in DB when the exact value is not know The below code doesn't give the desired result as it considers the whole as a string .

Select * from Table where column in ('%Val%','%AB%')
Praveen Prasannan
  • 6,970
  • 10
  • 50
  • 70
misguided
  • 3,597
  • 20
  • 50
  • 94

3 Answers3

2
Select * from Table where column like  '%Val%' or column like '%AB%';
Praveen Prasannan
  • 6,970
  • 10
  • 50
  • 70
2
Select * from Table where column like '%Val%' or column like '%AB%'.....

I know its little hard to write you can create a vertical list and change \n and \r by '% and %' respectively.

om471987
  • 5,021
  • 5
  • 30
  • 39
0
SELECT * FROM Table
WHERE instr(column, 'Val', 1) > 0 or instr(column, 'AB', 1) > 0

or:

SELECT * FROM Table
WHERE contains(column, 'Val', 1) > 0 or contains(column, 'AB', 1) > 0
Nir Alfasi
  • 51,812
  • 11
  • 81
  • 120
  • CONTAINS is an Oracle Text operator, and will only work on columns with the appropriate index. – APC Jul 24 '13 at 12:00