Oracle/PLSQL: REPLACE Function-from cyber

Oracle/PLSQL: REPLACE Function

This Oracle tutorial explains 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 REPLACE function in Oracle/PLSQL is:

REPLACE( string1, string_to_replace [, replacement_string] )

Parameters or Arguments

string1
The string to replace a sequence of characters with another set of characters.
string_to_replace
The string that will be searched for in string1.
replacement_string
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');
Result: 'tech'

REPLACE('123tech123', '123');
Result:'tech'

REPLACE('222tech', '2', '3');
Result: '333tech'

REPLACE('0000123', '0');
Result: '123'

REPLACE('0000123', '0', ' ');
Result: '    123'

转载于:https://www.cnblogs.com/Jeffrey-xu/p/4819601.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值