Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Unanswered: Decode statement with number and string..!

    Hi,

    I've a decode statement which returns number or string depending on the condition.
    For instance,
    Datatype of weight is of number(7,2).
    Datatype of flag is varchar2(2).

    Decode(flag,'N','?',NULL,weight)

    The above statement returns,
    ?
    -.21 (which should be -0.21)
    -.56 (which should be -0.56)

    Could any please help me in solving this problem ?

    Thanks,
    Kalai.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Use TO_CHAR with a format mask, e.g.

    Decode(flag,'N','?',NULL,TO_CHAR(weight,'999990.00 '))

Posting Permissions

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