# StoredProc

Execute a stored procedure.

## Component Signature

```
<bx:StoredProc procedure=[string]
datasource=[string]
blockfactor=[integer]
debug=[boolean]
returnCode=[boolean]
result=[string]
username=[string]
password=[string] />
```

### Attributes

| Atrribute     | Type      | Required | Description                                                                                    | Default        |
| ------------- | --------- | -------- | ---------------------------------------------------------------------------------------------- | -------------- |
| `procedure`   | `string`  | `true`   | The name of the procedure to execute.                                                          |                |
| `datasource`  | `string`  | `false`  | The name of the datasource where the stored procedure is registered.                           |                |
| `blockfactor` | `integer` | `false`  | The fetch size to use for batching rows and reducing network round trips when reading results. |                |
| `debug`       | `boolean` | `false`  | If enabled, list debugging info on each statement.                                             | `false`        |
| `returnCode`  | `boolean` | `false`  | True/false whether to capture the return code of the stored procedure in the result variable.  | `false`        |
| `result`      | `string`  | `false`  | The name of the variable to store the result set in.                                           | `bxstoredproc` |
| `username`    | `string`  | `false`  |                                                                                                |                |
| `password`    | `string`  | `false`  |                                                                                                |                |

## Examples

### Tag Syntax

Basic example of calling a stored procedure, passing a parameter, and getting a result set.

```java
<bx:storedproc procedure="spu_my_storedproc" datasource="myDSN">
	<bx:procparam sqltype="integer" value="#myParameterValue#">
	<bx:procresult name="qResults">
</bx:storedproc>
```

### Script Syntax

Call stored procedure and get back multiple result sets.

```java
bx:storedproc procedure="spu_my_storedproc" datasource="myDSN" {
	bx:procparam sqltype="date" value=myDateParam;
	bx:procresult name="qSummary" resultset=1;
	bx:procresult name="qDetails" resultset=2;
}

```

### Scripted Tag Syntax

Call stored procedure and get back multiple result sets.

```java
bx:storedproc procedure="spu_my_storedproc" datasource="myDSN" {
	procparam( sqltype="date", value=myDateParam );
	procresult( name="qSummary", resultset=1 );
	procresult( name="qDetails", resultset=2 );
}

```


---

# Agent Instructions: 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:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/components/jdbc/storedproc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
