sqloracleoracle-text

CONTAINS in Oracle 11.2


Is it possible to use something working like CONTAINS function from new Oracle? I have 11.2 and would like to do sth like this:

select * from cars
inner join customers on customers.as_id = cars.as_id
where cars.type like 'AUDI' and contains(request, customers.name, 1) > 0;

so as I know I can't use LIKE here because customers.name is not a fixed value. Is there a way to find some workaround for old Oracle?


Solution

  • You can use LIKE as follows:

    select * 
      from cars
     inner join customers on customers.as_id = cars.as_id
     where cars.type = 'AUDI' -- You can use = here
       and request like '%' || customers.name || '%';
    

    Note: contains clause is used for finding specific strings within an Oracle Text index. it can not be applied on normal columns.