-3

I am curious to see if there is a way to input a list of strings within the regexp_like() function in SQL.

Example:

SELECT *
FROM TABLE_1
AND REGEXP_LIKE(COLUMN_1, '2007239,;
2007294,
2007296,
2007295,
2007297,
1398852,
1398837,
1398744')
;

I understand that this is not possible but is there a way to do this without being too repetitive (i.e. having too many regexp_like() in one query).

alex_fields1
  • 71
  • 1
  • 1
  • 11
  • Maybe you could share some input samples so that people could have a look what are you actually after? – wp78de Jul 05 '18 at 20:06

2 Answers2

1

You could use PL/SQL to create a explicit cursor(loop) to run query with each like string.

see https://www.tutorialspoint.com/plsql/plsql_cursors.htm for cursor example

0

Just use | in your regex.

REGEXP_LIKE(COLUMN_1, '\b(2007239|2007294|2007296)\b')
blhsing
  • 70,627
  • 6
  • 41
  • 76