forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
6.1 KiB
6.1 KiB
factorial
This function is used to return the factorial of a.
Syntax
factorial(INT a)
Parameters
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. |
Return Values
The return value is of the BIGINT type.
Example Code
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);
Parent topic: Mathematical Functions