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

Home -> Community -> Usenet -> c.d.o.server -> Re: question about substr

Re: question about substr

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 23 Jul 2007 06:58:05 -0700
Message-ID: <1185199084.872141@bubbleator.drizzle.com>


haomiao wrote:
> Hi
>
> (1) When I run
> select 1 from dual where '1 ' = substr('21',2,1)
> no result return. There is spaces in the left operand.
>
> (2) When I run
> select 1 from dual where '1 ' = substr('21',
> 2,1) || ' '
> 1 result return
>
> (3) And when I run
> select 1 from dual where '1 ' = '1'
> 1 result return
>
> What is the difference between (1)and(3)?
> Can I find a better method than (2) , so I can eaily compare
> without counting the spaces in '1 '
>
> Thanks.

Consider using TRIM

http://www.psoug.org/reference/string_func.html#strm

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Mon Jul 23 2007 - 08:58:05 CDT

Original text of this message

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