CEILING Function Examples | Teradata Vantage - Examples - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-30
dita:mapPath
tpt1555966086716.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantageā„¢

Example: Querying SELECT CEILING(157E-1);

The following query returns the FLOAT value 16E0, since 16 is the smallest integer that is not less than the FLOAT value 15.7E0.

SELECT CEILING(157E-1);

Example: Querying SELECT CEILING(15.7);

The following query returns a DECIMAL value of 16.0 since 16 is the smallest integer that is not less than the DECIMAL literal 15.7.

SELECT CEILING(15.7);

Example: Querying SELECT CEILING(-12.3);

The following query returns a DECIMAL value of -12.0 since -12 is the smallest integer that is not less than the DECIMAL literal -12.3.

SELECT CEILING(-12.3);

Example: Querying SELECT CEIL( CAST(9.99 AS DECIMAL(3,2)) );

The following query returns the value 10.00 with a data type of DECIMAL(4,2), since 10 is the smallest integer that is not less than 9.99. Note that the precision of the return value is increased by 1.

SELECT CEIL( CAST(9.99 AS DECIMAL(3,2)) );