With the stored procedure provider it is possible to call a stored procedure in one of your databases when a record is created, updated, deleted or when a data import has been done.
On the bottom you can find the actual statement that will be executed on the database when the workflow is triggered. The Try now button on the top right will execute this statement directly to test the execution.
When the try button does not return an error the stored procedure is executed successfully.
For SQL Server it is important that the name of the fields matches the name of the input parameters of your stored procedure
For other databases like MYSQL or PostgreSQL the sequence of the fields matter. As the example in the management console displays, the fields will be sent in the order of the list.
Example in Postgresql
In this example we create a stored procedure that will consume 4 fields (user, status, accountmanager and sales_amount. It will write this data to a table `stored_procedure_data`.
CREATE TABLE
public.stored_procedure_data (
id SERIAL,
"user" character varying(255) NULL,
status character varying(255) NULL,
accountmanager character varying(255) NULL,
sales_amount character varying(255) NULL,
created_at timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE OR REPLACE procedure (
"user" character varying,
"status" character varying,
"sales" character varying,
"name" character varying
)
language plpgsql
as $$
begin
INSERT INTO stored_procedure_data ("user", "status", "accountmanager", "sales_amount")
VALUES ("user", status, name, sales);
commit;
end;$$
Example in MySQL
CREATE TABLE
stored_procedure_data (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`user` VARCHAR(255) NULL,
`status` VARCHAR(255) NULL,
`accountmanager` VARCHAR(255) NULL,
`sales_amount` VARCHAR(255) NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DELIMITER //
CREATE PROCEDURE MyStoredProcedure (
IN user VARCHAR(255),
IN status VARCHAR(255),
IN sales VARCHAR(255),
IN name VARCHAR(255)
)
BEGIN
INSERT INTO stored_procedure_data (`user`, `status`, `accountmanager`, `sales_amount`)
VALUES (user, status, name, sales);
END //
DELIMITER ;