This function is used to return the factorial of a.
factorial(INT a)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
a |
Yes |
BIGINT, INT, SMALLINT, or TINYINT |
The value is an integer. If the value is not of the INT type, the system will implicitly convert it to the INT type for calculation. The string is converted to its corresponding ASCII code. |
The return value is of the BIGINT type.
The value 720 is returned.
select factorial(6);
The value 1 is returned.
select factorial(1);
The value 120 is returned.
select factorial(5.123456);
The value NULL is returned.
select factorial(null);
The value NULL is returned.
select factorial(21);