Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: question about string matching with trailing blanks

Re: question about string matching with trailing blanks

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Sat, 8 Sep 2001 19:33:37 +0400
Message-ID: <9nddh9$qvk$1@babylon.agtel.net>


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...

> 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?
>
>
>
>
Received on Sat Sep 08 2001 - 10:33:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US