Updated on 2023-10-25 GMT+08:00

pow

This function is used to calculate and return the pth power of a.

Syntax

pow(DOUBLE a, DOUBLE p), 
power(DOUBLE a, DOUBLE p)

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

a

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The value can be a float, integer, or string.

If the value is not of the DOUBLE type, the system will implicitly convert it to the DOUBLE type for calculation.

p

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The value can be a float, integer, or string.

If the value is not of the DOUBLE type, the system will implicitly convert it to the DOUBLE type for calculation.

Return Values

The return value is of the DOUBLE type.

If the value of a or p is NULL, NULL is returned.

Example Code

The value 16 returned.

select pow(2, 4);

The value NULL is returned.

select pow(2, null);

The value 17.429460393524256 is returned.

select pow(2, 4.123456);