Skip to main content

Celonis Product Documentation

DIV
Description

The division operator computes the quotient of two values.

The division operator can be applied to INT or FLOAT columns or constants. The data type of the result is always a FLOAT. If the values of the second input column or constant (the divisor) is 0 (division by zero), the resulting value is set to NULL.

Syntax
 DIV ( table.column1 , table.column2 )
 table.column1 / table.column2
NULL handling

If one of the input values is NULL, the result is NULL as well.

Examples

[1]

Divide a column of type INT by a constant INT value:

Query

Column1

         "Table1"."Column1" / 10
        

Input

Output

Table1

Column1 : int

10

20

30

40

Result

Column1 : float

1.0

2.0

3.0

4.0

[2]

Divide a column of type FLOAT by a constant FLOAT value:

Query

Column1

         "Table1"."Column1" / 10.0
        

Input

Output

Table1

Column1 : float

10.0

20.0

30.0

40.0

Result

Column1 : float

1.0

2.0

3.0

4.0

[3]

Divide a column of type INT by a constant FLOAT value:

Query

Column1

         "Table1"."Column1" / 10
        

Input

Output

Table1

Column1 : float

10.0

20.0

30.0

40.0

Result

Column1 : float

1.0

2.0

3.0

4.0

[4]

Divide a column of type INT by a constant INT value. Note, that the division by zero for the second and third row does not result in an error, but returns null:

Query

Column1

         "Table1"."Column1" / "Table1"."Column2"
        

Input

Output

Table1

Column1 : int

Column2 : int

10

10

20

0

30

0

40

10

Result

Column1 : float

1.0

null

null

4.0

[5]

Divide values of multiple INT and FLOAT columns:

Query

Column1

         "Table1"."IntColumn1" / "Table1"."IntColumn2"
        

Column2

         DIV ( "Table1"."IntColumn1" , "Table1"."FloatColumn1" )
        

Column3

         "Table1"."FloatColumn1" / "Table1"."FloatColumn2"
        

Column4

         "Table1"."IntColumn1" / "Table1"."IntColumn2" / "Table1"."FloatColumn1"
        

Column5

         DIV ( "Table1"."IntColumn1" , "Table1"."IntColumn2" / "Table1"."FloatColumn1" )
        

Input

Output

Table1

IntColumn1 : int

IntColumn2 : int

FloatColumn1 : float

FloatColumn2 : float

20

5

10.0

20.0

30

15

14.0

7.0

40

null

12.0

22.0

50

30

null

23.0

null

45

14.0

null

Result

Column1 : float

Column2 : float

Column3 : float

Column4 : float

Column5 : float

4.0

2.0

0.5

0.4

40.0

2.0

2.14285714286

2.0

0.14285714286

28.0

null

3.33333333333

0.54545454545

null

null

1.6666667

null

null

null

null

null

null

null

null

null