---
title: pmod function
description: Learn the syntax of the pmod function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/pmod
---

# `pmod` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the positive remainder after `dividend / divisor`.

## Syntax

```
pmod(dividend, divisor)
```

## Arguments

* `dividend`: An expression that evaluates to a numeric.
* `divisor`: An expression that evaluates to a numeric.

## Returns

If both `dividend` and `divisor` are of `DECIMAL` the result matches the type of `divisor`.
In all other cases a `DOUBLE`.

If `divisor` is 0, Databricks raises a [REMAINDER\_BY\_ZERO](https://docs.databricks.com/aws/en/error-messages/error-classes.md#remainder_by_zero) error.

## Common error conditions

* [REMAINDER\_BY\_ZERO](https://docs.databricks.com/aws/en/error-messages/error-classes.md#remainder_by_zero)

## Examples

```sql
> SELECT pmod(10, 3), mod(10, 3);
 1  1

> SELECT pmod(-10, 3), mod(-10, 3);
 2 -1

> SELECT pmod(-10, 0);
 Error: REMAINDER_BY_ZERO
```

## Related functions

* [`mod` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/mod.md)
* [`%` (percent sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentsign.md)
