question about substr

Giganews Newsgroups
Subject: question about substr
Posted by:  haomiao (miaoha…@ustc.edu)
Date: Mon, 23 Jul 2007

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.

Replies