Results 1 to 3 of 3

Thread: Decode

  1. #1
    Join Date
    May 2004

    Unanswered: Decode

    I have a table having a column sal which contains the values 5004, 4005 etc.

    I want to show the output as 5000 if sal is greater than 5000 else as it is.

    Can it be done using DECODE. Using CASE it can be done..

    Thanks In advance

  2. #2
    Join Date
    Apr 2004
    using decode:
    decode( sign(5000-sal),-1,5000, sal)

    but since you're still displaying a number, even the same number is some cases:
    least( sal, 5000 )
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  3. #3
    Join Date
    Jul 2003
    perhaps case would be better?
    PHP Code:
    (CASE when sal 5000 then 5000 else sal END
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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