* (asterisk sign) operator (Databricks SQL)

Returns multiplier multiplied by multiplicand.

Syntax

multiplier * multiplicand

Arguments

  • multiplier: A numeric or INTERVAL expression.

  • multiplicand: A numeric expression or INTERVAL expression.

You may not specify an INTERVAL for both arguments.

Returns

  • If both multiplier and multiplicand are DECIMAL, the result is DECIMAL.

  • If multiplier or multiplicand is an INTERVAL, the result is of the same type.

  • If both multiplier and multiplicand are integral numeric types, the result is the larger of the two types.

  • In all other cases the result is a DOUBLE.

If either the multiplier or the multiplicand is 0, the operator returns 0.

If the result of the multiplication is outside the bound for the result type an error is raised.

Use try_multiply to return NULL on overflow.

Examples

> SELECT 3 * 2;
 6

> SELECT 2L * 2L;
 4L

> SELECT INTERVAL '3' YEAR * 3;
 9-0

> SELECT 100Y * 100Y;
 Error: 100 * 100 caused overflow