> For the complete documentation index, see [llms.txt](https://docs.wirebootstrap.com/wirebootstrap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wirebootstrap.com/wirebootstrap/reference/wire.data/wire.data.storedprocedure.md).

# wire.data.StoredProcedure

## Parameter Class

| Property  | Type             | Description                                                                                 |
| --------- | ---------------- | ------------------------------------------------------------------------------------------- |
| EventName | string           | Parameter name alias used to map a parameter to another parameter or field in another query |
| Name      | string           | Parameter name                                                                              |
| Value     | string \| number | Parameter value                                                                             |

## Properties

| Name   | Type   | Default | Description                                           |
| ------ | ------ | ------- | ----------------------------------------------------- |
| Name   | object | null    | The name of the stored procedure in the data service. |
| Params | \[ ]   | null    | An array of parameters for the stored procedure.      |

## Methods

| Name                | Description                                                                                                                   |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| cast                | Static method that casts an object with the same stored procedure properties into an instance of the `StoredProcedure` class. |
| eventName           | Adds an event name to a parameter                                                                                             |
| getParam(param)     | Returns the parameter object named `param`.                                                                                   |
| param(param, value) | Adds a value to a parameter using the chained method `procedure`.                                                             |

If a service provider supports executing stored procedures, it will set the [allow.storedProcedure](/wirebootstrap/reference/wire.data/wire.data.datasource.md#allow) attribute to `true`.

```javascript
const allowSprocs = accountService.allow().storedProcedure;
```

The following creates a new `StoredProcedure` object which will call the  stored procedure `spGetUsers` in the data service with a parameter `User` equal to `apeters`.

```javascript
const proc = wire.data.procedure("spGetUsers")
    .param("User", "apeters");
```

The following gets the stored procedure parameter object `UserName`.

```javascript
const param = proc.getParam("UserName");
```

The following is a [TypeScript](https://www.typescriptlang.org) example that executes the stored procedure in the data service.

```javascript
...

const dataTable = await accountService.execAsync(proc);
```

Visit [Creating Queries - Stored Procedures](/wirebootstrap/creating-queries/stored-procedures.md) for more details and examples.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wirebootstrap.com/wirebootstrap/reference/wire.data/wire.data.storedprocedure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
