Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2006
    Posts
    17

    Unanswered: where statement?

    Hi,

    I have a varchar field and in this field there may be chars like 'A','C' etc. or strings like "A-C", "A,C,H" etc or just decimal numbers like '0.4','4.2'.

    What i want to do is, just check for decimal numbers and which are bigger than 4.0.?

    here what i wrote but gives error:

    ...

    where left(RESULT,1) not between 'A' and 'Z' AND
    DECIMAL(SONUC) >= 4.0

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by raysefo
    What i want to do is, just check for decimal numbers and which are bigger than 4.0.?
    What about:
    Code:
    ...
    where left(RESULT,1) between '4' and '9'
       or   (left(RESULT,1) between '1' and '3'
              and substr(RESULT,2,1) between '0' and '9')
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Yes, the DECIMAL will bomb when the data is non-numeric.

    Check out this recent thread, it may help you.

    http://www.dbforums.com/showthread.php?t=1618889

    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •