> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 此函数可用于测试异常安全性。 它会在创建时按指定概率抛出异常。

# aggThrow

<div id="aggThrow">
  ## aggThrow
</div>

引入版本：v20.1.0

此函数可用于测试异常安全性。它会在创建时按指定概率抛出异常。

**语法**

```sql theme={null}
aggThrow(throw_prob)
```

**参数**

* `throw_prob` — 在创建时抛出异常的概率。[`Float64`](/zh/reference/data-types/float)

**返回值**

返回一个异常：`Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully`。

**示例**

**用法示例**

```sql title=Query theme={null}
SELECT number % 2 AS even, aggThrow(number) FROM numbers(10) GROUP BY even;
```

```response title=Response theme={null}
Received exception:
Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully: While executing AggregatingTransform. (AGGREGATE_FUNCTION_THROW)
```
