factorial function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns the factorial of expr.

Syntax

factorial(expr)

Arguments

  • expr: An INTEGER expression between 1 and 20.

Returns

A BIGINT.

If expr is out of bounds, the function returns NULL.

Examples

> SELECT factorial(5);
 120