Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: question about string matching with trailing blanks
yes, rtrim is necessary as Oracle will try to find exact match in this case and
'LABOR' is different from 'LABOR ' because they're of different length.
Also, if 'LABOR' is the only value you're checking for, and you are sure
you want to include all words *starting* with it (like 'LABORATORY') you
might want to issue
select * from a where dept like 'LABOR%'
with % being substitution char for any number of any trailing characters, including none.
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer. "Gary Beckler" <gbeckler_at_easystreet.com> wrote in message news:tpkcv1juhqk2e_at_corp.supernews.com...Received on Sat Sep 08 2001 - 10:33:37 CDT
> In the code below how does Oracle match on field with trailing spaces?
>
> create table a (
> dept char(6) );
>
> insert into a values ('LABOR ');
>
> select * from a where dept IN 'LABOR';
>
> Does "dept" match "LABOR"? Is the "rtrim" function necessary?
>
>
>
>
![]() |
![]() |