WriteBackExtreme
WebsiteAll products
V5.0
V5.0
  • Prologue
    • WriteBackExtreme v5
    • Release Notes
    • Changelogs
    • Architecture
      • Data Handling and Security in WriteBackExtreme (SaaS)
  • Installation guide
    • Requirements
      • Windows
      • Linux
    • Getting started
      • Windows
      • Linux
      • Containerization
        • Docker standalone
        • Docker compose
        • Repository database
        • ODBC connections
    • Installation wizard
      • License
      • Repository database
        • SQL Server
        • MySQL
        • PostgreSQL
        • SQLite
      • Create a user
      • URL & SSL Certificate
      • Run as a service
      • Summary
        • Running on Linux
    • Configuration panel
      • Home page
      • Domain & SSL Management
      • Repository Database
      • License Management
      • User Management
      • Ip Whitelisting
      • Primary keys in Data Add
    • Upgrade
      • Upgrade from 2.x
    • Update license
    • Moving to production
  • Product Guide
    • Getting started
    • Tableau Extension
      • Getting started
        • Create a worksheet with Username()
        • Add the Extension to your dashboard
        • Ready to start
      • Configuration
        • General
          • Schemas
          • Authentication
          • Popup
          • Theming
          • Tabs
          • Mapping
          • Tableau
          • Import/Export
          • Tableau Datasource
        • Schemas
          • General
            • Editable Conditions
          • Field Formatting
            • Single line text
            • Paragraph text
            • Number
            • Boolean
            • Dropdown select
              • Dynamic Populated content
              • Cascading dropdown
            • Date/DateTime
          • Form Builder
            • Features
            • Dynamic Values
              • Troubleshoot | values
        • Changelog
      • End-user
        • Features
          • Dynamic Filtering
          • Bulk Import
          • Audits (History)
          • Bulk Edit
          • Duplicate rows
        • Add Data
          • Overview
          • Add rows
          • Edit rows
        • Collaboration
          • Overview
          • Add / Edit
          • Reply
        • Data Helper
          • Overview
          • Add rows
          • Edit rows
        • Data Correction
          • Add records
          • Edit records
          • Remove records
          • Interpolate
          • Calculations
          • Vertical layout
        • SSO/SAML or Oauth authentication
    • Management console
      • Setup security
        • OAuth Setup
          • Microsoft Entra
          • Auth0
          • Google
        • SSO Setup
          • OKTA Example
          • PingOne Example
          • Azure Example
          • Troubleshooting SSO
      • Connections
      • Schemas
        • Permissions
        • Audits
        • Import/export
        • Row Level Security
        • Schema data
        • Workflows
          • Stored procedures
          • Tutorial (video)
      • Tableau sync
      • User management
      • Group management
      • Info & License
    • Database Connections
      • DataBricks
        • Windows
        • Linux
      • Snowflake
        • Using ODBC
          • Windows
          • Linux
        • OAuth Authentication
        • Key Pair
    • NEW: InputTables
  • Support
    • Troubleshoot
      • Errors
    • FAQ
Powered by GitBook
On this page
  • Example in Postgresql
  • Example in MySQL

Was this helpful?

  1. Product Guide
  2. Management console
  3. Schemas
  4. Workflows

Stored procedures

PreviousWorkflowsNextTutorial (video)

Last updated 4 months ago

Was this helpful?

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 ;

Tutorial (video)