15.00 - POWER - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)
Last Update
2018-09-24

POWER

Purpose  

Returns base_value raised to the power of exponent_value.

Syntax  

where:

 

Syntax element …

Specifies …

SYSLIB

the name of the database where the function is located.

base_value

a numeric argument.

If base_value is negative, exponent_value must be an integer.

If any input argument is NULL, the function returns NULL.

exponent_value

a numeric argument.

ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Invocation

POWER is an embedded services system function. For information on activating and invoking embedded services functions, see “Embedded Services System Functions” on page 24.

Argument Types and Rules

Expressions passed to this function must have one of the following data types:

BYTEINT, SMALLINT, INTEGER, BIGINT, DECIMAL/NUMERIC, FLOAT/REAL/DOUBLE PRECISION, or NUMBER

Result Type

If either of the input arguments is a FLOAT type, the result data type is FLOAT. Otherwise, the result data type is NUMBER.

For information on the default data type format for NUMBER or FLOAT, see SQL Data Types and Literals.

Example  

The following query returns the result 8.0.

   SELECT POWER(2, 3);

Example  

The following query returns the result 0.125.

   SELECT POWER(2, -3);

Example  

The following query returns the result 10.648.

   SELECT POWER(2.2, 3);

Example  

The following query returns an error because the base value is negative and the exponent value is not an integer.

   SELECT POWER(-2.2, 3.1);