Re: LIKE clause
Posted in 1998
aurelio wrote:
>
> Does anybody know a way to make a comparison between two strings: one
> is a column, the other is a variable string caugth as a parameter. The
> matter is that I must use wildcards, and they can be used within a
> quoted literal .
>
> PROCEDURE P1(string VARCHAR(5))
> ...
> SELECT ... FROM ... WHERE column LIKE '*string*' ; <-- This is> incorrect. The comparison will take place between the string in the
> column and the literal "string"
>
>
>
Try this:
SELECT ... FROM ... WHERE column LIKE '*'|string|'*';
or
SELECT ... FROM ... WHERE column LIKE '*' | TRIM(string) | '*';
If that doesn't work, try this:
DEFINE wstring VARCHAR(7);
LET wstring = '*' | string | '*';
-- or
LET wstring = '*' | TRIM(string) | '*';
I haven't tested any of this, it just ought to work! (Ever the
optimist.)
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
---
If all else fails, read the instructions and the release notes.
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/
---