ZWand19
ZWand19

Reputation: 113

Oracle SQL Regex Non-matching comma

We have defined a grammar and are storing expression strings in our database that follow this grammar. One possible term in our expressions is IIF(condition, then, else). I need to query our expressions table for all expressions that contain a '+' in the condition of an IIF.

What I am trying to do with this statement below is search for conditions with any number of non-comma characters followed by a '+' followed by any number of non-comma characters followed by a comma. Where am I going wrong?

select * from ... and value like '%IIF([^\,]*\+[^\,]*\,%';

Upvotes: 0

Views: 382

Answers (1)

Patrick Bacon
Patrick Bacon

Reputation: 4660

Using REGEXP_LIKE would work for this type of query. The REGEXP_LIKE function would be called in the where clause and the parameters for the function call would look something like this:

WHERE REGEXP_LIKE (column_xyz, '.*IFF\([^,]*\+[^,]*,')

Upvotes: 2

Related Questions