background image
<< Conversions from numeric types | Datetime to character syntax >>

CEIL or CEILING function

<< Conversions from numeric types | Datetime to character syntax >>
Derby Reference Manual
119
CEIL or CEILING function
The CEIL and CEILING functions round the specified number up, and return the smallest
number that is greater than or equal to the specified number.
The specified number must be a
DOUBLE PRECISION
number.
· If the specified number is NULL, the result of these functions is NULL.
· If the specified number is equal to a mathematical integer, the result of these
functions is the same as the specified number.
· If the specified number is zero (0), the result of these functions is zero.
· If the specified number is less than zero but greater than -1.0, then the result of
these functions is zero.
The returned value is the smallest (closest to negative infinity) double floating point value
that is greater than or equal to the specified number. The returned value is equal to a
mathematical integer. The data type of the returned value is a DOUBLE PRECISION
number.
Syntax
CEIL ( number )
CEILING ( number )
CHAR function
The CHAR function returns a fixed-length character string representation.
The representations are:
· A character string, if the first argument is any type of character string.
· A datetime value, if the first argument is a date, time, or timestamp.
· A decimal number, if the first argument is a decimal number.
· A double-precision floating-point number, if the first argument is a DOUBLE or
REAL.
· An integer number, if the first argument is a SMALLINT, INTEGER, or BIGINT.
The first argument must be of a built-in data type. The result of the CHAR function is a
fixed-length character string. If the first argument can be null, the result can be null. If
the first argument is null, the result is the null value. The first argument cannot be an
XML value. To convert an XML value to a CHAR of a specified length, you must use the
SQL/XML serialization operator XMLSERIALIZE.
Character to character syntax
CHAR (CharacterExpression [, integer] )
CharacterExpression
An expression that returns a value that is CHAR, VARCHAR, LONG VARCHAR, or
CLOB data type.
integer
The length attribute for the resulting fixed length character string. The value must be
between 0 and 254.
If the length of the character-expression is less than the length attribute of the result,
the result is padded with blanks up to the length of the result. If the length of the
character-expression is greater than the length attribute of the result, truncation is
performed. A warning is returned unless the truncated characters were all blanks and the
character-expression was not a long string (LONG VARCHAR or CLOB).
Integer to character syntax