Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: question about substr
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.orgReceived on Mon Jul 23 2007 - 08:58:05 CDT
![]() |
![]() |