select trunc(column1/123) from tab1;

解决方案 »

  1.   

    select floor(column/123) from tbname;SQL> select floor(350/123) from dual;FLOOR(350/123)
    --------------
                 2
      

  2.   

    select cast((column/123)as int) from table
      

  3.   

    SQL> select ceil(15/4) from dual;CEIL(15/4)
    ----------
             4SQL> select floor(15/4) from dual;FLOOR(15/4)
    -----------
              3SQL> select round(15/4) from dual;ROUND(15/4)
    -----------
              4SQL> select trunc(15/4) from dual;TRUNC(15/4)
    -----------
              3
      

  4.   

    The FLOOR function returns the smallest integer that is less than or equal to the supplied value. For example, if you send it 4.231 it will return 4, if you send it 4 it will return 4. This is similar to ROUNDDOWN functions in other languages and in spreadsheets.This function is useful in cases where your result must be up to but not greater than a range, such as extents for a block or were the result must be an integer value (no decimals). A similar function, CEIL, will round the number up instead of down.PL/SQL Example:Here are some examples of the values returned by FLOOR:FLOOR (6.2)            ==> 6
    FLOOR (-89.4)          ==> -90The CEIL or ceiling function returns the smallest integer that is greater than or equal to the supplied value. For example, if you send it 4.231 it will return 5, if you send it 4 it will return 4. This is similar to ROUNDUP functions in other languages and in spreadsheets.This function is useful in cases where your result must be inclusive of a range, such as blocks for a table or were the result must be an integer value (no decimals). A similar function, FLOOR, will round the number down instead of up.PL/SQL Example:
      
    Some examples of the effect of CEIL:CEIL (6)          ==> 6
    CEIL (119.1)      ==> 120
    CEIL (-17.2)      ==> -17The TRUNC function truncates the number supplied to the specified number of places. If no place number is supplied, it rounds to zero decimal places. If the place number is negative, the number is truncated that many places to the right of the decimal place. This function does no rounding, it simply deletes the un-wanted numbers and returns the rest. PL/SQL Example:TRUNC (153.46)            ==> 153
    TRUNC (153.46, 1)         ==> 153.4
    TRUNC (-2003.16, -1)      ==> -2000