From: Dan Lauterbach <danla@micromotion.com>
To: pgsql-sql@postgresql.org
Subject: How match percent sign in SELECT using LIKE?
Date: Wed, 10 Mar 1999 14:00:18 -0700
Message-ID: <36E6DD61.EFC1B2F4@micromotion.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: danla@micromotion.com
Subject: Re: How match percent sign in SELECT using LIKE?
In-Reply-To: <36E6DD61.EFC1B2F4@micromotion.com>
References: <36E6DD61.EFC1B2F4@micromotion.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox