log
The log function is used to return the logarithm of a number a with a given base base.
Syntax
log(DOUBLE base, DOUBLE a)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| base | Yes | DOUBLE, BIGINT, DECIMAL, or STRING | The format of parameter `base` includes floating-point format, integer format, and string format. If parameter base is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation. |
| a | Yes | DOUBLE, BIGINT, DECIMAL, or STRING | The format of parameter a includes floating-point format, integer format, and string format. If parameter a is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation. |
Return Values
Returns a value of type DOUBLE.
- If base or a is NULL, NULL is returned.
- If base or a is negative or 0, NULL is returned.
- If base is 1 (which would cause a division by zero), NULL is returned.
Example Code
Returns 2.
select log(2, 4);
Returns NULL.
select log(2, null);
Returns NULL.
select log(null, 4);
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