Home > Database > Mysql Tutorial > body text

Oracle 常用字符函数之Translate

WBOY
Release: 2016-06-07 17:16:09
Original
1354 people have browsed it

Oracle 常用字符函数之Translate,返回将出现在from中的每个字符替换为to中相应字符,若from比to字符串长,那么在from中比to多出

语法:TRANSLATE(char,from,to)

用法:返回将出现在from中的每个字符替换为to中相应字符,,若from比to字符串长,那么在from中比to多出的字符串将被删除。三个参数中有一个是空,返回值也将是空值。

举例:

select translate('abcdefga','abc','wo') from dual;

分析:该语句要将'abcdefga'中的'abc'转换为'wo',由于'abc'中'a'对应'wo'中的'w',故将'abcdefga'中的'a'全部转换成'w',而'abc'中'b'对应'wo'中的'o',故将'abcdefga'中的'b'全部转换成'o','abc'中的'c'在'wo'中没有与之对应的字符,故将'abcdefga'中的'c'全部删除;

linux

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!