1

I am trying to write a hql query to search one word from comma separated words.

My input is like abc,xyz,par.

Expected result: Should be displayed the matched record if any of the words matches the REGEX.

I tried with REGEXP_LIKE regular expression (Ex: REGEXP_LIKE(columnname, "value")) in hql but it is not working.

Please suggest me an hql query for given scenario.

UPDATE: My attempt is:

SELECT emp.title 
FROM employee as emp 
WHERE 1=1 and (emp.title regexp_like (emp.title, :empTitle))

Thanks in advance.

morels
  • 2,095
  • 17
  • 24

1 Answers1

0

I believe you can get away with just using LIKE and eschewing more complex regex methods. Try using this WHERE clause:

WHERE columnname LIKE 'value,' OR
      columnname LIKE ',value,' OR
      columnname LIKE ',value'
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360