Ingres SQL illegal pattern match and illegal escape sequence, unexpected results

218 Views Asked by At

I am querying a database that uses Ingres 10.2. I cannot seem to get any of my pattern matching code to work as I expect it to.

For example:

SELECT TOP 20 * 
FROM table_name 
WHERE variable_name IN ('XaKDG', 'XaKDH')

returns both XaKDG and XaKDH as expected.

However, when trying this:

SELECT TOP 5 * 
FROM table_name 
WHERE variable_name LIKE 'XaKD\[GH\]' escape  '\'

I get the following errors:

ERROR '22025' 1315172
Illegal pattern match specified
Illegal ESCAPE sequence.

I am baffled, as the user guide states the following:

"To match any string starting with 0 through 4, followed by an uppercase letter, then a [, any two characters and a final ]:"

name like '\[01234\]\[A-Z\][__]' escape '\'

As far as I can tell, my query should be correct. I also tried without the escape characters at all, and with double escape characters. These didn't produce any errors, but also did not return anything.

I appreciate any help.

The User guide is here: https://supportactian.secure.force.com/help/servlet/fileField?id=0BEf3000000PLPf

0

There are 0 best solutions below