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

# ST_NRings

Returns the number of rings in a Polygon or MultiPolygon. Contrary to ST\_NumInteriorRings,
this function also takes into account the number of  exterior rings.

This function returns 0 for an empty Polygon or MultiPolygon.
If the geometry is not a Polygon or MultiPolygon, an IllegalArgument Exception is thrown.

<img src="https://mintcdn.com/wherobots/wLm_IRUSNlHZTHJP/images/sql-functions/ST_NRings/ST_NRings.svg?fit=max&auto=format&n=wLm_IRUSNlHZTHJP&q=85&s=2d969ad79afbfe49510a1572c4dd3345" alt="ST_NRings" width="500" height="300" data-path="images/sql-functions/ST_NRings/ST_NRings.svg" />

## Signatures

```sql theme={"system"}
ST_NRings(geom: Geometry)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

## Return type

<ResponseField type="Integer">
  An integer value.
</ResponseField>

## Example

**Input:** `POLYGON ((1 0, 1 1, 2 1, 2 0, 1 0))`

```
1
```

**Input:** `'MULTIPOLYGON (((1 0, 1 6, 6 6, 6 0, 1 0), (2 1, 2 2, 3 2, 3 1, 2 1)), ((10 0, 10 6, 16 6, 16 0, 10 0), (12 1, 12 2, 13 2, 13 1, 12 1)))'`

```
4
```

**Input:** `'POLYGON EMPTY'`

```
0
```

**Input:** `'LINESTRING (1 0, 1 1, 2 1)'`

```
Unsupported geometry type: LineString, only Polygon or MultiPolygon geometries are supported.
```
