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

# CALL

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `CALL` <InternalLink path="sql-statements">statement</InternalLink> invokes a <InternalLink path="stored-procedures">stored procedure</InternalLink>.

## Required privileges

To call a procedure, a user must have <InternalLink path="security-reference/authorization#supported-privileges">`EXECUTE` privilege</InternalLink> on the procedure.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/uBcLAizjWFXF4pfd/images/sql-diagrams/v25.1/call.svg?fit=max&auto=format&n=uBcLAizjWFXF4pfd&q=85&s=8c89b6a06b9dd6c63b4310e491ad1850" alt="call syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="445" height="37" data-path="images/sql-diagrams/v25.1/call.svg" />

## Parameters

| Parameter      | Description                                 |
| -------------- | ------------------------------------------- |
| `proc_name`    | The name of the procedure to call.          |
| `param_values` | A comma-separated list of parameter values. |

## Examples

### Call a stored procedure

The following statement calls the <InternalLink path="stored-procedures">`delete_earliest_histories` example procedure</InternalLink>, specifying 5 rows to delete and a `rides_left` cursor name:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CALL delete_earliest_histories (5, 'rides_left');
```

```
NOTICE: Deleted ride 0a3d70a3-d70a-4d80-8000-000000000014 with timestamp 2019-01-02 03:04:05
NOTICE: Deleted ride 0b439581-0624-4d00-8000-000000000016 with timestamp 2019-01-02 03:04:05.001
NOTICE: Deleted ride 09ba5e35-3f7c-4d80-8000-000000000013 with timestamp 2019-01-02 03:04:05.002
NOTICE: Deleted ride 0fdf3b64-5a1c-4c00-8000-00000000001f with timestamp 2019-01-02 03:04:05.003
NOTICE: Deleted ride 049ba5e3-53f7-4ec0-8000-000000000009 with timestamp 2019-01-02 03:04:05.004
CALL
```

## See also

* <InternalLink path="stored-procedures">Stored Procedures</InternalLink>
* <InternalLink path="plpgsql">PL/pgSQL</InternalLink>
* <InternalLink path="create-procedure">`CREATE PROCEDURE`</InternalLink>
* <InternalLink path="alter-procedure">`ALTER PROCEDURE`</InternalLink>
* <InternalLink path="drop-procedure">`DROP PROCEDURE`</InternalLink>
