The use of Translate functions __ functions

Source: Internet
Author: User
Syntax format: TRANSLATE (expr,from_string,to_string)

sql> SELECT TRANSLATE (' ab hello cde ', ' abcde ', ' 123456 ') as New_str from DUAL;

New_str
---------
12 Hello 345

from_string and to_sting in characters, corresponding to character one by one replaces.

sql> SELECT TRANSLATE (' Ab Hello Cade ', ' abcde ', ' 123456 ') as New_str from DUAL;

New_str
----------
12 Hello 3145
You can see that the character ' a ' is also replaced with ' 1 ' in the back, and Chinese characters are not replaced.


if to_string is empty, it is returned as a null value.

sql> SELECT TRANSLATE (' Ab Hello Cade ', ' abcde ', ') as New_str from DUAL;

N
-

if the to_string corresponds to a position where there are no characters, deleting the characters listed in the from_string will be erased.

sql> SELECT TRANSLATE (' Ab Hello Cade ', ' 1abcde ', ' 1 ') as new_str from DUAL;

New_
----
hello.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.