Subject | Re: [firebird-support] Autotrim? |
---|---|
Author | Mark Rotteveel |
Post date | 2012-03-02T08:15:33Z |
On Fri, 02 Mar 2012 09:03:02 +0100, Mark Rotteveel <mark@...>
wrote:
believe ' ' IS DISTINCT FROM '' should work.
Mark
wrote:
> On Tue, 28 Feb 2012 07:37:59 -0000, "syn.erpy" <syn.erpy@...>wrote:
>> Hi,an
>>
>> we ran into a little problem regarding blanks.
>>
>> Try the following code (FB 2.5.1):
>>
>> <code>
>> create exception blank 'blank';
>>
>> SET TERM ^ ;
>>
>> create OR alter procedure p_test
>> as
>> begin
>>
>> IF (' ' = '') THEN
>> exception blank;
>> end
>> ^
>>
>> SET TERM ; ^
>>
>> execute procedure p_test;
>>
>>
>> </code>
>>
>> If you run it, the exception is raised. My question is why Firebird
> thinks
>> that a blank (or two or three or four for that matter) is the same as
>> empty string. Is this a bug or an intended feature?the
>
> Because that is what the SQL standard defines: When comparing strings
> shorter string is padded with spaces to the length of the longer string,the
> and then they are compared. So if two strings have the same prefix and
> rest is a (different) number of spaces, then they are still consideredthe
> same.I am not 100% sure (and no Firebird installation at hand to check), but I
believe ' ' IS DISTINCT FROM '' should work.
Mark