Subject | Re: [firebird-support] LTRIM and RTRIM failures |
---|---|
Author | Milan Babuskov |
Post date | 2006-05-11T20:30:52Z |
Rick Debay wrote:
didn't bother to read rest of the message as you placed the question on top:
http://lists.freebsd.org/pipermail/freebsd-chat/2004-August/002567.html
As for original question...
shown below). Perhaps you could give more details: FB version, operating
system, database (and column) charset.
I took FB2.0 and used the EMPLOYEE database:
update employee
set first_name = ' Robert '
where first_name = 'Robert';
commit;
select
'*'||first_name||'*' original, strlen(first_name) len,
'*'||ltrim(first_name)||'*' ltrimmed,
'*'||rtrim(first_name)||'*' rtrimmed,
'*'||ltrim(rtrim(first_name))||'*' bothtrim,
strlen(ltrim(rtrim(first_name)))
from EMPLOYEE
where first_name CONTAINING 'Rob';
returns:
ORIGINAL LEN LTRIMMED RTRIMMED BOTHTRIM STRLEN
------------- --- ----------- ---------- --------- ------
* Robert * 11 *Robert * * Robert* *Robert* 6
*Roberto* 7 *Roberto* *Roberto* *Roberto* 7
Everything looks ok to me.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
> Table DDL shows the field as VARCHAR.Oh, I see it now. Well, now you know why top-posting is Bad(tm). I
didn't bother to read rest of the message as you placed the question on top:
http://lists.freebsd.org/pipermail/freebsd-chat/2004-August/002567.html
As for original question...
> Let's test that particular item againI guess this is the problem? However, I'm unable to reproduce it (as
> Select strlen(po.PO), strlen(ltrim(rtrim(po.PO)))
> from RPL_PO po where po.ID = 3144
> Results: 11, 11
shown below). Perhaps you could give more details: FB version, operating
system, database (and column) charset.
I took FB2.0 and used the EMPLOYEE database:
update employee
set first_name = ' Robert '
where first_name = 'Robert';
commit;
select
'*'||first_name||'*' original, strlen(first_name) len,
'*'||ltrim(first_name)||'*' ltrimmed,
'*'||rtrim(first_name)||'*' rtrimmed,
'*'||ltrim(rtrim(first_name))||'*' bothtrim,
strlen(ltrim(rtrim(first_name)))
from EMPLOYEE
where first_name CONTAINING 'Rob';
returns:
ORIGINAL LEN LTRIMMED RTRIMMED BOTHTRIM STRLEN
------------- --- ----------- ---------- --------- ------
* Robert * 11 *Robert * * Robert* *Robert* 6
*Roberto* 7 *Roberto* *Roberto* *Roberto* 7
Everything looks ok to me.
> Hmmm, let me put quotes around it in order to see leading or trailingThis one looks ok too.
> characters
> select '''' || po.PO || '''' from rpl_po po where po.ID = 3144
> Results: '2895-01V '
>
> Let's test LTRIM and RTRIM and see what they return
> select
> strlen(ltrim(rtrim(' xxx '))),
> ascii_val(substring(' xxx ' from 5 for 1))
> from rdb$database
> Results: 3, 32
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org