Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003

    Unanswered: Equivalent to the "Ceiling" function

    Does anyone know if there is an equivalent to the "CEILING" function, available in SQL server, in Informix?

    For any Informix officionados who don't know SQL Server, the ceiling function rounds up a number to the next whole number, regardless of the decimal portion of a number. For example

    SELECT CEILING(4.2) --returns 5
    SELECT CEILING(5) --returns 5
    SELECT CEILING(5.2 + 7.1) --returns 13

    I need equivalent functionality and couldn't find any hints in the informix docs.

    Many thanks,

  2. #2
    Join Date
    Apr 2003
    Phoenix, AZ
    There is no built-in function but you could write your own. Simple example:

    drop function ceiling(decimal);

    create function ceiling(invalue decimal) returning decimal;
    define retvalue decimal;
    if (invalue = trunc(invalue,0))
    return invalue;
    return trunc(invalue,0)+1;
    end if
    end function;
    Fred Prose

  3. #3
    Join Date
    Apr 2003


    Thanks for that. As informix is a bit of a new area for me, I didn't think of that! I tried using dbaccess to create this function and it gave me a syntax error so I'm going to have to do a bit more learning around the subject before I can implement this solution. In the meantime I'll implement a fix by writing a similar function in c# in my data tier. Not pretty, I know, but thanks for the help.

  4. #4
    Join Date
    Aug 2009
    I was registered at your forum. I have printed the test message. Do not delete, please.

    gratuit pour mobile sonnerie portable mp3 - Sonnerie portable MP3 est en effet un pouvoir de l'innovation technologique. Êtes-vous familier avec cette sonnerie portable?gratuit pour mobile sonnerie portable mp3

  5. #5
    Join Date
    Apr 2007
    Jundiai / SP - Brasil
    Yes Informix have a "CEILING" function, but only after the version 11.10...

    Check the links bellow...

    CEIL Function

    IBM Informix Dynamic Server v11.50 Information Center
    César Inacio Martins
    Jundiai / SP - Brasil - em Português - English (translated by Google).

Posting Permissions

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