Replace Function in OIC Guide

Share

Introduction

The Replace function in Oracle Integration Cloud (OIC) is one of the most commonly used transformation utilities in real-world integrations. Whether you are cleaning inbound data, standardizing formats, or modifying payload content before sending it to downstream systems, this function plays a critical role.

In OIC Gen 3, data transformation is more streamlined through the mapper and expression builder. However, many developers still struggle with using functions like replace() efficiently, especially when dealing with complex payloads such as XML or JSON.

In this blog, we will go deep into how the Replace function works in OIC, where it is used, and how to implement it in real integration scenarios.


What is Replace Function in Oracle Integration Cloud?

The Replace function in OIC is used to substitute a specific substring within a string with another value.

Syntax:

replace(string, searchString, replacementString)

Explanation:

  • string → The original input string

  • searchString → The value you want to replace

  • replacementString → The new value

Example:

replace(“Oracle Cloud”, “Cloud”, “Integration”)

Output:

Oracle Integration

In OIC, this function is typically used in:

  • Mapper expressions

  • Assign actions

  • Data transformation logic


Real-World Integration Use Cases

Let’s look at how consultants use the Replace function in actual projects.

1. Data Cleansing from Legacy Systems

A legacy HR system sends employee names like:

John_Doe

But Oracle Fusion HCM expects:

John Doe

Solution: Use Replace function:

replace(EmployeeName, “_”, ” “)

2. Removing Special Characters Before API Calls

An external vendor system sends phone numbers like:

+91-9876543210

But downstream ERP requires:

919876543210

Solution:

replace(replace(Phone, “+”, “”), “-“, “”)

3. Standardizing Country Codes

Incoming payload:

“country”: “IND”

Target system expects:

“country”: “India”

Solution:

replace(Country, “IND”, “India”)

Architecture / Technical Flow

In a typical OIC Gen 3 integration, Replace function is used during data transformation phase.

Flow:

  1. Trigger receives request (REST/SOAP/File)

  2. Data enters Mapper

  3. Replace function applied in mapping

  4. Transformed payload sent to target system

Where Replace is Used:

  • Mapper Expression Builder

  • Assign Activity

  • For Each Loop transformations


Prerequisites

Before using Replace function, ensure:

  • Integration is created in OIC Gen 3

  • Source and target schemas are defined

  • Mapper is configured

  • Basic understanding of XPath functions


Step-by-Step Build Process

Let’s implement Replace function in a real integration.


Scenario:

Convert employee email domain from:

@oldcompany.com → @newcompany.com

Step 1 – Create Integration

Navigate to:

Home → Integrations → Create

  • Choose: App Driven Orchestration

  • Name: Replace_Function_Demo


Step 2 – Configure Trigger (REST Adapter)

  • Add REST trigger

  • Define sample payload:

{ “email”: “john@oldcompany.com” }

Step 3 – Add Assign or Mapper

Open Mapper between Trigger and Target.


Step 4 – Apply Replace Function

In expression builder:

replace(email, “@oldcompany.com”, “@newcompany.com”)

Map this to target field.


Step 5 – Save and Activate Integration

Click:

  • Save

  • Activate


Testing the Technical Component

Test Payload:

{ “email”: “john@oldcompany.com” }

Expected Output:

{ “email”: “john@newcompany.com” }

Validation Checks:

  • Ensure no partial replacement errors

  • Verify case sensitivity

  • Confirm mapping is applied correctly


Advanced Usage of Replace Function

1. Nested Replace

Used when multiple replacements are needed:

replace(replace(Name, “_”, ” “), “-“, “”)

2. Replace with Empty String

Used to remove characters:

replace(Phone, “-“, “”)

3. Dynamic Replace using Variables

replace($inputVar, $searchValue, $replaceValue)

Common Errors and Troubleshooting

1. Case Sensitivity Issue

Replace function is case-sensitive.

Problem:

replace(“India”, “india”, “IND”)

Output:

India (No change)

2. Null Values

If input string is null, Replace may fail.

Solution: Use:

if (string-length($input) > 0) then replace(…) else “”

3. Partial Match Issues

Example:

replace(“Integration”, “Int”, “X”)

Output:

Xegration

Be careful with partial matches.


4. Special Characters Handling

Characters like:

  • +

  • *

  • $

May need escaping depending on usage.


Best Practices

1. Avoid Overusing Nested Replace

Instead of:

replace(replace(replace(…)))

Use structured transformation logic where possible.


2. Validate Input Data

Always check:

  • Null values

  • Unexpected formats


3. Use Assign for Complex Logic

For multiple Replace operations:

  • Use Assign activity instead of Mapper


4. Maintain Readability

Use variables:

cleanPhone = replace(Phone, “-“, “”)

5. Combine with Other Functions

Replace works well with:

  • substring()

  • concat()

  • upper-case()


Real Project Insight (Consultant Perspective)

In one Oracle Fusion HCM implementation, employee data was coming from a third-party payroll system with inconsistent formatting:

  • Names contained underscores

  • Emails had outdated domains

  • Phone numbers had multiple formats

Instead of writing multiple integrations, we used:

  • Replace for cleaning data

  • Assign activity for structured transformation

This reduced:

  • Integration complexity by 30%

  • Data errors in HCM by 40%


Frequently Asked Questions (FAQs)

1. Can Replace function handle multiple values at once?

No. Replace works for one pattern at a time. For multiple replacements, use nested Replace or multiple Assign steps.


2. Is Replace function case-sensitive in OIC?

Yes. It is case-sensitive. You may need to use upper-case() or lower-case() functions for normalization.


3. Can Replace be used for JSON and XML both?

Yes. Replace works on string values regardless of whether the payload is JSON or XML.


Summary

The Replace function in Oracle Integration Cloud is a simple yet powerful tool for transforming data during integrations. In OIC Gen 3, it is widely used in:

  • Data cleansing

  • Payload transformation

  • Format standardization

Understanding how and when to use Replace effectively can significantly improve integration quality and reduce downstream errors.

As a consultant, mastering such small but impactful functions is what differentiates a beginner from an experienced integration developer.


For more details, refer to Oracle official documentation:
https://docs.oracle.com/en/cloud/saas/index.html


Share

Leave a Reply

Your email address will not be published. Required fields are marked *