Oracle Select--character function: TRANSLATE (STRING,FROM_STR,TO_STR) __c language

Source: Internet
Author: User
Tags rtrim

--Character function:

1, TRANSLATE (STRING,FROM_STR,TO_STR)

Returns a string that replaces each character in the FROM_STR (all occurrences) with the corresponding character in To_str. Translate is a superset of the functionality provided by replace. If the from_str is longer than TO_STR, the extra characters in from_str that are not in To_str are removed from string because they do not have corresponding substitution characters. The to_str cannot be empty. Oracle interprets an empty string as null, and if any argument in translate is null, the result is null.

Example:
Sql> Select Translate (' Kvenchou_zhou ', ' Kvenchou ', ' 12345678 ') from dual;

TRANSLATE (' KV
-------------
12345678_z678

Sql> Select Translate (' Uokvenchuuuuuooooou ', ' kvu ', ' en ') from dual;

TRANSLATE (' U
------------
Ozhenchooooo

Sql> Select Translate (' Uokvenchuuuuuooooou ', ' kvo ', ' Zhuo ') from dual;

TRANSLATE (' Uokvench
-------------------
Uuzhenchuuuuuuuuuuu


2, LTRIM (x,y)

The LTrim (x,y) function truncates the characters in X by one of the characters in Y, and is executed from the left, as long as the characters in Y are encountered, the characters in X are truncated until the function command ends when the character in X is encountered with no characters in Y.

Example:
Sql> Select LTrim (' 10900119224319 ', ' 109 ') from dual;

LTRIM (
------
224319

Sql> Select LTrim (' 109005119224319 ', ' 109 ') from dual;

LTRIM (' 109
----------
5119224319


3, RTRIM (x,y) relative to LTrim

Example:
Sql> Select RTrim (' Kvenchuuuuuooooou ', ' ou ') from dual;

RTRIM (
------
Kvench

Sql> Select RTrim (' Kvenchuuuuuoozooou ', ' ou ') from dual;

RTRIM (' Kvenchu
--------------
Kvenchuuuuuooz

Related Article

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.