How match percent sign in SELECT using LIKE? - Mailing list pgsql-sql

From Dan Lauterbach
Subject How match percent sign in SELECT using LIKE?
Date
Msg-id 36E6DD61.EFC1B2F4@micromotion.com
Whole thread Raw
List pgsql-sql
How do I match '%' in a SELECT query using LIKE predicate?   For
example, to query for DocNo's containing string 'EW%':

SELECT * FROM XXXX WHERE DocNo LIKE '%EW%%';

PostgreSQL wants to treat the '%' in 'EW%' as a wildcard.  I've tried
escaping the '%' using '\%', '%%'.   The SQL-92 standard provides for
this using the ESCAPE keyword:

SELECT * FROM XXXX WHERE DocNo LIKE '%EW#%%' ESCAPE '#';

However, PostgreSQL doesn't appear to support the ESCAPE keyword.  Any
suggestions would be greatly appreciated.  I'm using PostgreSQL v6.2.1.

Thanks,
Dan Lauterbach


pgsql-sql by date:

Previous
From: "Jackson, DeJuan"
Date:
Subject: RE: [HACKERS] Bug on complex subselect (was: Bug on complex join)
Next
From: Sue Hanen
Date:
Subject: Recording Date,Time and UserId when a record is modified