factorial
The factorial 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 format of parameter a is an integer format. If parameter a is not of type INT, it is implicitly converted to INT type before evaluation. Strings are converted to their corresponding ASCII codes. |
Return Values
Returns a value of type BIGINT.
- If a is 0, 1 is returned.
- If a is NULL or outside the range [0,20], NULL is returned.
Example Code
Returns 720.
select factorial(6);
Returns 1.
select factorial(1);
Returns 120.
select factorial(5.123456);
Returns NULL.
select factorial(null);
Returns NULL.
select factorial(21);
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot