Stay organized with collections
Save and categorize content based on your preferences.
Execute a stored procedure
This example shows how to run a stored procedure when you are using a database connection.
The example assumes that you are familiar with the following concepts:
All stored procedures in a database connection are exposed to you as actions in the
Connector task. An action is a first
class function that is made available to the integration through the connector interface. Actions
let you make changes to an entity or entities, and vary from connector to connector. However, it is possible
that a connector doesn't support any action, in which case the Actions list will be empty.
The following connectors support stored procedures:
Consider you have a MySQL database which has the following stored procedure that gets a
customer's information from the customers table:
CREATE PROCEDURE get_customer_info
(IN p_customer_id INT, OUT p_name VARCHAR(50), OUT p_email VARCHAR(255))
BEGIN
SELECT name, email INTO p_name, p_email
FROM customers
WHERE id = p_customer_id;
END
This stored procedure returns the name and email for the specified customer. It takes
in the customer ID through the p_customer_id input variable and returns the
name and email in the p_name and p_email output variables, respectively.
Now suppose you want to get the name and email id of the customer with customer_id=1001,
you must do the following tasks:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eStored procedures in a database connection are accessible as actions within the Connector task in Application Integration.\u003c/p\u003e\n"],["\u003cp\u003eConnectors such as BigQuery, Cloud SQL, MySQL, Oracle DB, PostgreSQL, SQL Server, MariaDB, AlloyDB, Snowflake, and Redshift support stored procedures.\u003c/p\u003e\n"],["\u003cp\u003eTo execute a stored procedure, you need to configure a Connector task with a database connection and select the desired procedure from the list of available actions.\u003c/p\u003e\n"],["\u003cp\u003eInput parameters for a stored procedure can be specified through a JSON payload in the Connector task's \u003ccode\u003econnectorInputPayload\u003c/code\u003e section.\u003c/p\u003e\n"],["\u003cp\u003eThe output of a successfully executed stored procedure will be returned as a JSON payload in the \u003ccode\u003econnectorOutputPayload\u003c/code\u003e variable.\u003c/p\u003e\n"]]],[],null,["# Execute a stored procedure\n==========================\n\nThis example shows how to run a stored procedure when you are using a database connection.\nThe example assumes that you are familiar with the following concepts:\n\n- [Creating integrations using Application Integration](/application-integration/docs/try-sample-integration-ecommerce)\n- [Connector task](/application-integration/docs/configure-connectors-task)\n- [Integration Connectors](/integration-connectors/docs/overview)\n- Database stored procedures\n\nAll stored procedures in a database connection are exposed to you as actions in the\n[Connector task](/application-integration/docs/configure-connectors-task). An action is a first\nclass function that is made available to the integration through the connector interface. Actions\nlet you make changes to an entity or entities, and vary from connector to connector. However, it is possible\nthat a connector doesn't support any action, in which case the `Actions` list will be empty.\n\nThe following connectors support stored procedures:\n\n- [BigQuery](/integration-connectors/docs/connectors/bigquery/configure)\n- [Cloud SQL - MySQL](/integration-connectors/docs/connectors/cloudsqlformysql/configure)\n- [Cloud SQL - PostgreSQL](/integration-connectors/docs/connectors/cloudsqlforpostgresql/configure)\n- [Cloud SQL - SQL Server](/integration-connectors/docs/connectors/cloudsqlforsqlserver/configure)\n- [MySQL](/integration-connectors/docs/connectors/mysql/configure)\n- [Oracle DB](/integration-connectors/docs/connectors/oracledb/configure)\n- [PostgreSQL](/integration-connectors/docs/connectors/postgresql/configure)\n- [SQL Server](/integration-connectors/docs/connectors/sqlserver/configure)\n- [MariaDB](/integration-connectors/docs/connectors/mariadb/configure)\n- [AlloyDB](/integration-connectors/docs/connectors/alloydb/configure)\n- [Snowflake](/integration-connectors/docs/connectors/snowflake/configure)\n- [Redshift](/integration-connectors/docs/connectors/redshift/configure)\n\n### Example\n\nConsider you have a MySQL database which has the following stored procedure that gets a\ncustomer's information from the `customers` table: \n\n```\nCREATE PROCEDURE get_customer_info\n(IN p_customer_id INT, OUT p_name VARCHAR(50), OUT p_email VARCHAR(255))\nBEGIN\n SELECT name, email INTO p_name, p_email\n FROM customers\n WHERE id = p_customer_id;\nEND\n```\n\nThis stored procedure returns the name and email for the specified customer. It takes\nin the customer ID through the `p_customer_id` input variable and returns the\nname and email in the `p_name` and `p_email` output variables, respectively.\n\nNow suppose you want to get the name and email id of the customer with `customer_id=1001`,\nyou must do the following tasks:\n\n1. Create a [connection to your MySQL database](/integration-connectors/docs/connectors/mysql/configure).\n2. Open or create a new [integration](/application-integration/docs/quickstarts).\n3. Add the [Connectors task](/application-integration/docs/configure-connectors-task) to your integration.\n4. In the **Configuration** section, click **Configure task** to open the **Configure connector task** pane.\n5. Configure the Connectors task to use the connection you created in step 1.\n 1. In the **Connection** column, select the required connection from the list of available connections.\n\n\n After you select a connection, the **Type** column appears with the values\n `Entities` and `Actions`. All the stored procedures will be listed\n in **Actions**.\n 2. Select **Actions \\\u003e get_customer_info**.\n 3. Click **Done** to complete the connection configuration and close the pane.\n6. Click the `Connectors` task element, and then click `connectorInputPayload` in the `Task Input` section.\n7. Specify the following JSON payload in the `Default Value` field: \n\n ```\n {\n \"customer_id\": 1001\n }\n ```\n8. Click the **Test** button in the integration editor toolbar to run the integration.\n\n If the integration runs successfully, the `connectorOutputPayload`\n vairable will have a JSON payload similar to the following: \n\n ```\n {\n \"name\": \"John\",\n \"email\": \"john@test.com\"\n }\n ```"]]