Search code examples
sqloraclesql-like

Using LIKE and IN in Oracle SQL


I need to do multiple LIKEs .

I have the following code

select * from product where product_code LIKE IN ('MS%','TS%')

However I am getting the following error

ORA-00936: missing expression 00936. 00000 - "missing expression"

Am I using the correct syntax?

Thanks


Solution

  • It is not possible in Oracle to use LIKE and IN together.

    You must have to write Multiple LIKE and use OR as follows:

    select * from product 
    where (product_code LIKE 'MS%' 
       OR product_code LIKE 'TS%');