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

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Exploring Data Redaction Enhancements in Oracle Database 23ai
  • Fixing Common Oracle Database Problems
  • Understanding Time Series Databases
  • Why Database Migrations Take Months and How to Speed Them Up

Trending

  • Leveraging AI: A Path to Senior Engineering Positions
  • Advanced gRPC in Microservices: Hard-Won Insights and Best Practices
  • Orchestrating Edge Computing with Kubernetes: Architectures, Challenges, and Emerging Solutions
  • Micro Frontends to Microservices: Orchestrating a Truly End-to-End Architecture
  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
12.6K 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
  • Understanding Time Series Databases
  • Why Database Migrations Take Months and How to Speed Them Up

Partner Resources

×

Comments

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: