Home >Database >Mysql Tutorial >Oracle函数repalce用户

Oracle函数repalce用户

WBOY
WBOYOriginal
2016-06-07 17:08:351307browse

语法:REPLACE(char, search_string,replacement_string)用法:将char中的字符串search_string全部转换为字符串replacement_stri

语法:REPLACE(char, search_string,replacement_string)

用法:将char中的字符串search_string全部转换为字符串replacement_string,,没有匹配的字符串就都不变。

举例:

SQL> select REPLACE('fgsgswsgs', 'fk' ,'j') from dual;返回值from dual;

结果是fgsgswsgs

SQL> select REPLACE('fgsgswsgs', 'sg' ,'eeerrrttt')返回值from dual;

结果是fgeeerrrtttsweeerrrttts

分析:第一个例子中由于'fgsgswsgs'中没有与'fk'匹配的字符串,故返回值仍然是'fgsgswsgs';

第二个例子中将'fgsgswsgs'中的字符串'sg'全部转换为'eeerrrttt'。

总结:综上所述,replace与translate都是替代函数,只不过replace针对的是字符串,而translate针对的是单个字符

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn