tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment

Other Sites

CheckYourMath BigActivities DigMinecraft
Share this page:

Oracle/PLSQL: REPLACE Function

Learn how to use the Oracle/PLSQL REPLACE function with syntax and examples.

Description

The Oracle/PLSQL REPLACE function replaces a sequence of characters in a string with another set of characters.

Syntax

The syntax for the Oracle/PLSQL REPLACE function is:

REPLACE( string1, string_to_replace, [ replacement_string ] )

Parameters or Arguments

string1 is the string to replace a sequence of characters with another set of characters.

string_to_replace is the string that will be searched for in string1.

replacement_string is optional. All occurrences of string_to_replace will be replaced with replacement_string in string1. If the replacement_string parameter is omitted, the REPLACE function simply removes all occurrences of string_to_replace, and returns the resulting string.

Applies To

The REPLACE function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let's look at some Oracle REPLACE function examples and explore how to use the REPLACE function in Oracle/PLSQL.

For example:

REPLACE('123123tech', '123'); would return 'tech'
REPLACE('123tech123', '123'); would return 'tech'
REPLACE('222tech', '2', '3'); would return '333tech'
REPLACE('0000123', '0'); would return '123'
REPLACE('0000123', '0', ' '); would return '    123'