> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TRY_MULTIPLY

> Multiplies two numbers, returning NULL on integer or decimal overflow.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for a NULL operand or integer/decimal overflow. Floating-point overflow remains infinity.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
try_multiply(left, right)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| left | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | The first factor. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |
| right | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | The second factor. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |

## Returns

* Type: The common converted integer or floating type; DECIMAL(p, s) from the multiplication precision/scale rule for decimal inputs
* Possible values: The numeric product.
* NULL behavior: Returns NULL for a NULL operand or integer/decimal overflow. Floating-point overflow remains infinity.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Partial (Integer multiplication is exact when it fits. Decimal scale reduction rounds the result, and floating-point multiplication can round.) |

* Approximation bound: No fixed bound is declared for floating-point products.

## Usage notes

* Nondecimal factors are converted to a common numeric type before multiplication. Decimal factors keep their individual precision and scale.
* For DECIMAL(p1,s1) and DECIMAL(p2,s2), natural precision is p1 + p2 + 1 and natural scale is s1 + s2. If natural precision is at most 38, those values form the result type.
* When natural precision exceeds 38, result precision is 38 and result scale is min(s1 + s2, max(38 - ((p1-s1) + (p2-s2) + 1), 6)). Scale reduction rounds halfway values away from zero.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Normal values and NULL behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_multiply(CAST(6 AS BIGINT), CAST(7 AS BIGINT)) AS product, try_multiply(CAST(9223372036854775807 AS BIGINT), CAST(2 AS BIGINT)) AS overflow, try_multiply(CAST(NULL AS BIGINT), CAST(2 AS BIGINT)) AS null_value;
```

| product | overflow | null\_value |
| - | - | - |
| 42 | NULL | NULL |

### Decimal multiplication

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_multiply(CAST(2.50 AS DECIMAL(8,2)), CAST(3 AS DECIMAL(8,2))) AS product;
```

| product |
| - |
| 7.5000 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.