MULTIPLY()
All functions > MATH > MULTIPLY()
Returns the product of two numbers, or scales an interval by an integer factor.
Signatures
Numeric multiplication
Returns: Product of the two numbers
MULTIPLY(number1: T, number2: T) → T sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number1 | T | Yes | First number to multiply |
number2 | T | Yes | Second number to multiply |
With:
T: Any numeric type
Signature notes:
- Both arguments must be of the same numeric type
- Returns NULL if either operand is NULL
- Multiplication is commutative:
a * b = b * a
Related operators
Examples
MULTIPLY(...)
FeatureQL
SELECT
f1 := MULTIPLY(3, 4) -- Function call
;Result
| f1 BIGINT |
|---|
| 12 |
.MULTIPLY(...) — chained
FeatureQL
SELECT
f1 := (3).MULTIPLY(4), -- Integer literal: parenthesize for `.MULTIPLY` on BIGINT
f2 := 1.5.MULTIPLY(3) -- Decimal base: chain without extra parentheses
;Result
| f1 BIGINT | f2 VARCHAR |
|---|---|
| 12 | 4.5 |
Interval scaling
FeatureQL
SELECT
f1 := INTERVAL_PARSE('1 day') * 3, -- Scale a day interval
f2 := 5 * INTERVAL_PARSE('2 hours'), -- Integer on the left side
f3 := INTERVAL_PARSE('15 minutes') * 4, -- Compose sub-hour intervals
f4 := INTERVAL_PARSE('1 hour') * 0 -- Zero factor yields zero interval
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR |
|---|---|---|---|
| 3 days 00:00:00 | 0 days 10:00:00 | 0 days 01:00:00 | 0 days 00:00:00 |
Edge cases
FeatureQL
SELECT
f1 := MULTIPLY(-5, 2), -- Negative factor
f2 := MULTIPLY(0, 100), -- Multiplication by zero
f3 := MULTIPLY(1.5, 3.0), -- DECIMAL × DECIMAL
f4 := MULTIPLY(1.5E0, 3.0E0) -- DOUBLE × DOUBLE
;Result
| f1 BIGINT | f2 BIGINT | f3 VARCHAR | f4 VARCHAR |
|---|---|---|---|
| -10 | 0 | 4.5 | 4.5 |