SK SKYVVA Documentation

How to call Stored Procedure With ORACLE Database Via invokeCalloutV3?

Introduction

A stored procedure is a set of SQL statements with an assigned name, which are stored in an RDBMS as a group, so it can be reused and shared by multiple programs. Stored procedures can access or modify data in a database, but it is not tied to a specific database or object, which offers a number of advantages. In this tutorial, we use the ORACLE database as an example. In here, when we call the Stored Procedure to the Database to do any database operation, we have expected it will respond back the result to the Salesforce. In this case, we need to have the INPUT and OUTPUT parameters in the Stored Procedure and create a Request and Response Interface corresponding to those parameter types. The ORACLE database located on EC2 instance and the Stored Procedure was written to Insert new data if no record present on the Database and update data if the record exists. Pre-required

Step-1: Create Integration and test connection destination For creating new Integration by followed this guide #article/what-is-an-integration-and-how-to-create-it

Step2: Create Inbound and Inbound Database Adapter for connection to ORACLE database presented on EC2 instance Step-3 Generate Message Type from the database

Fill all required information then click the button Retrieve Database

[su_box title="Note" box_color="#2a8af0" title_color="#000000"] For Database Stored Procedure, we have a template for generating Message Type for a single Table

Step 4: Set up Interface

Create an inbound Interface for Synchronous mode, operation(upsert), choose Adapter, Metadata Provider, Repository and Message Type (Response)

Step -5 Linking Response Interface to Request Interface In this example Request Interface is "ORACLE_StoredProcedure_REQUEST_Account_ATN" and Response Interface is "ORACLE_StoredProcedure_Response_Account_ATN"

Step -6 Checking Cache status Before sending data from Salesforce to Agent or from Agent to Salesforce, we need to check on Cache Monitor, make sure Cache record present on H2. Step -7 Callout V3 Navigate to Setup gear icon => Developer Console => Debug menu => Open Execute Anonymous Window then put code for update Account object then click the Execute button. [aux_code language="javascript" theme="tomorrow" extra_classes=""] skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl(); c.returnJSONComplete=true; c.actionDoIntegrate=true; c.isCreateMessage=true; String[] ids= new String[]{'0011j00000wp7i1AAA'}; skyvvasolutions.Iservices.invokeCalloutV3('StoredProcedure-Integration','ORACLE_StoredProcedure_REQUEST_Account_ATN',ids,'SYNC',c); [/aux_code] Check the result on Message Monitoring The Stored Procedure has been executed and response to Salesforce correctly

Summary

Finally, we have learned how to call Stored Procedure from Salesforce to the database, and respond to the Salesforce, we have known how the Message type structure generated from the Database.

Open this article in the interactive viewer →