> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CEILING

> Rounds a number upward to an integral value.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`ceil`](/query/sql/functions/math/ceil)

Returns NULL when an argument is NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
ceiling(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | The number to round. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |

## Returns

* Type: FLOAT or DOUBLE for floating-point or converted numeric input; DECIMAL(p, 0) for DECIMAL(p, s) input. Query tools can report a different type depending on the SQL dialect; see Usage notes.
* Possible values: An integral-valued result in the indicated numeric type.
* NULL behavior: Returns NULL when an argument is NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* DECIMAL input keeps its precision and returns scale 0. Integer input is converted to floating point before calculation.
* The Databricks SQL dialect can report a different result type, but the numeric calculation is the same. These forms do not cover date or time rounding.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Alias calling form: CEILING

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT ceiling(CAST(-1.5 AS DOUBLE)) AS "value", ceiling(CAST(NULL AS DOUBLE)) AS null_value;
```

| value | null\_value |
| - | - |
| -1 | NULL |

### Alias calling form: CEILING (Databricks)

* Databricks SQL parser dialect.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT ceiling(CAST(-1.5 AS DOUBLE)) AS value, ceiling(CAST(NULL AS DOUBLE)) AS null_value;
```

| value | null\_value |
| - | - |
| -1 | NULL |

## Limitations

* The result is FLOAT or DOUBLE for floating-point inputs, and DECIMAL(p, 0) for DECIMAL inputs. Integer inputs are converted to floating point. Query tools may report the input type in the E6 dialect, or DECIMAL or BIGINT in the Databricks dialect; those labels do not convert the result.
* Integer operands converted to floating point can lose precision beyond the exactly representable integer range. Use a DECIMAL operand when exact large-integer rounding is required.
* In the Databricks SQL dialect, query tools report BIGINT for nondecimal inputs and decimals with precision below 19. With ENABLE\_DECIMAL\_128 enabled and decimal precision at least 19, they report DECIMAL. The actual result remains FLOAT, DOUBLE, or DECIMAL(p, 0), depending on the input.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.