Re: LIKE operator. How does it work?
Posted in 1996
Topics: Data Types & Schema Design
Giuliano Ferraro wrote:
>
> Hi,
> I'm porting an application from Oracle to Informix. I've this kind
> of trouble. In a table T with a VARCHAR column C, there are some
> strings with ended space. For example, in the C column of the
> table T, there are the following strings:
>
> 'Hello '
> 'Hello world'
> 'Message 1'
> 'Message 2'
> 'Informix Online '
>
> When I use LIKE operator to retrieve strings with ended spaces
>
> SELECT C FROM T WHERE C LIKE '% ';>
> I get all values stored in the table. Is this the right way to work
> for Informix?
> With Oracle, the previous SQL statement retrieves only strings with
> ended spaces as requested.
>
> I'm having many trobles with Informix so I think that Oracle is better!!!
Well with a comment like THAT to end your question, I'm not sure you
DESERVE an answer.
But this is a very interesting problem, and one I would report as a bug.
Of course I do have a work around.....
Say "nice Informix, wonderful Informix...",
Okay, that's better. So try:
SELECT C +------- Notice the space in here
FROM T v
WHERE C||"_" LIKE '% _';
Where the underscore (_) is any character you choose.
Hope that helps,
--
Mark.
+-------------------------------------------------------------------------+
|Mark D. Stock - The West Solutions Group http://www.west.co.za |
| The Informix FAQ is at http://www.iiug.org |
|mailto:marks@west.co.za +------------------------------------------------+
|Tel: +27 11 803 2151 |If it doesn't work... force it! |
|Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! |
|Cell: +27 83 250 2325 |Well, that's how I code anyway! |
+------------------------+------------------------------------------------+