oracle replace()函数用法
在oracle数据库中我们要替换字符串会用到replace函数,下面来我给大家详细介绍oracle中replace()使用方法,有需要了解的朋友可参考。
在oracle数据库中我们要替换字符串会用到replace函数,下面来我给大家详细介绍oracle中replace()使用方法,有需要了解的朋友可参考。用法介绍
REPLACE(char, search_string [, replacement_string ] )
char : 等待替换的字符串
search_string : 搜索需要替换的字符串
replacement_string : 替换字符串
如果replacement_string缺省或者为null,那么所有char中出现的search_string 都将被移除
如果search_string为null,那么结果就是char
代码如下 | 复制代码 |
SELECT REPLACE('JACK and JUE','J','BL') "Changes" FROM DUAL; |
例1
把中‘2011-10-11’ 的格式,结果导入的数据为 ‘2011/10/11’
代码如下 | 复制代码 |
update 表1 t set t.列1=replace(( 列1from 表1 a where a.主键列=t.主键列) , '/' , '-' ) 解决了我们问题。 |
replace 字符串级别的代替
如:
代码如下 | 复制代码 |
SELECT REPLACE('accd','cd','ef') from dual; --> aefd |
translate 字符级别的代替
如:
代码如下 | 复制代码 |
select translate('acdd','cd','ef') from dual; -->aeff |
分别详解
replace:
语法:REPLACE(char,search_string[,replacement_string])
解释:replace中,每个search_string都被replacement_string所代替
代码如下 | 复制代码 |
select replace('acdd','cd','ef') from dual; --> aefd |
如果replacement_string为空或为null,那么所有的search_string都被移除
代码如下 | 复制代码 |
select replace('acdd','cd','') from dual; --> ad |
如果search_string 为null,那么就返回原来的char
代码如下 | 复制代码 |
select replace('acdd','ef') from dual; -->acdd elect replace('acdd','','') from dual; -->acdd |
(也是两者都为空的情况)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Replace characters (strings) in a string using Java's String.replace() function In Java, strings are immutable objects, which means that once a string object is created, its value cannot be modified. However, you may encounter situations where you need to replace certain characters or strings in a string. At this time, we can use the replace() method in Java's String class to implement string replacement. The replace() method of String class has two types:

In PHP program development, sometimes text content needs to be processed, including replacing the Enter key. Below we will briefly introduce how to replace the Enter key in PHP.

PHP regular expressions are a powerful tool for text processing and conversion. It can effectively manage text information by parsing text content and replacing or intercepting it according to specific patterns. Among them, a common application of regular expressions is to replace strings starting with specific characters. We will explain this as follows

With the continuous development of the Internet, PHP's application scenarios are becoming more and more extensive. In PHP development, sometimes you need to replace special characters in a string. In this case, you can use regular expressions for replacement. This article will introduce how to use regular expressions to replace special characters in strings in PHP. First, learn the basics of regular expressions. Regular expressions are a language used to describe patterns in some strings. Regular expressions include some special characters, such as ., *, +, ?, etc. These special characters have special meanings. in PH

PHP is a widely used scripting language that can be used to develop various web applications and websites. In these applications, strings are an integral part. In many cases, we need to perform operations such as replacing, splitting or intercepting strings. This article will explain how to replace a string from the left in PHP.

preg_replace() function in PHP: How to replace a string using regular expressions, specific code examples are needed In PHP, the preg_replace() function is a very powerful and flexible function that allows us to search and replace characters using regular expressions string. Whether it is to remove specific characters from a string or replace text in a specific format, the preg_replace() function can help us achieve it easily. First, let's take a look at preg_replace()

Replacing strings is one of the most basic operations in PHP. The replacement function is crucial in data processing and string operations, and can improve program execution efficiency and performance. There are many functions for replacing strings in PHP, such as: substr_replace, str_replace, preg_replace and so on. But for specific string replacements, special replacement rules may need to be used. In this article, we will learn how to replace the 11 digits after the colon.

Use the strings.Replace function to replace substrings in a string and set the number of replacements. In the Go language, we can use the strings.Replace function to replace substrings in a string. The signature of this function is as follows: funcReplace(s,old,newstring,nint)string where s represents the original string, old represents the substring to be replaced, new represents the replaced substring, and n represents the number of times to replace. Pass below
