DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Exploring Data Redaction Enhancements in Oracle Database 23ai
  • Fixing Common Oracle Database Problems
  • Production Database Migration or Modernization: A Comprehensive Planning Guide [Part 2]
  • Custom Model Context Protocol (MCP) for NL2SQL: A Rigorous Evaluation Framework on Oracle Database

Trending

  • Spring AI Advisors: Chat Memory, Token Tracking, and Message Logging
  • Dear Micromanager: Your Distrust Has a Job; It’s Just Not the One You’re Doing
  • What Is Lambda Architecture? Ultimate Guide to Getting Started
  • Throughput vs Goodput: The Performance Metric You Are Probably Ignoring in LLM Testing
  1. DZone
  2. Data Engineering
  3. Databases
  4. Mule: How to Upsert Data in the Oracle Database

Mule: How to Upsert Data in the Oracle Database

See how to upsert data in the Oracle Database.

By 
Muralidhar Gumma user avatar
Muralidhar Gumma
·
Sep. 17, 19 · Code Snippet
Likes (2)
Comment
Save
Tweet
Share
13.0K Views

Join the DZone community and get the full member experience.

Join For Free

Image title

How do we upsert data in Oracle?

Most of the time, we get into a situation where we need to perform an upsert operation (update the record if else Insert exists). We do not have a separate database operation to achieve this upsert functionality. Below, you will see this upsert functionality achieved using the Merge function in the database.

GOAL: You want to perform Bulk Updates in a Mule 4 Application.

NOTE: As a requirement, you will need to use the DB Connector 1.5.1 version or above.

SQL Merge is an Update function, so you will need to use the Update Connector.

See the code below:

<db:bulk-update doc:name="Bulk update" doc:id="ab77f2ce-8185-40ee-9704-99d5e4c31a43" config-ref="Oracle">
<db:sql >MERGE INTO destination USING origin ON (Id = :Id)
WHEN MATCHED
THEN UPDATE SET Id = :Id,
Price =
:Price
WHEN NOT MATCHED THEN INSERT (Id, Price) VALUES (
:Id, :Price)</db:sql>
<db:bulk-input-parameters ><![CDATA[#[[{'Id': 2, 'Price': 200m= }]]]]></db:bulk-input-parameters>
</db:bulk-update>


Further Reading

MuleSoft, Salesforce UPSERT

External Data Operations on Salesforce Analytics Using Mulesoft Salesforce Analytics Connector Part 1

Database Oracle Database Data (computing)

Opinions expressed by DZone contributors are their own.

Related

  • Exploring Data Redaction Enhancements in Oracle Database 23ai
  • Fixing Common Oracle Database Problems
  • Production Database Migration or Modernization: A Comprehensive Planning Guide [Part 2]
  • Custom Model Context Protocol (MCP) for NL2SQL: A Rigorous Evaluation Framework on Oracle Database

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook