Replace, length, LENGTHB, substr, SUBSTRB functions in Oracle

Source: Internet
Author: User

1. Replace
Replace (x, y, z) returns a result string that replaces the Y-string in string X with a Z-string.
replace (x, y) return value removes the character string x as the Y string
Cases:
Epacel (' aaabbb ', ' BBB ', ' CCC ')
Results: AAACCC
2, length indicates the character of the string
SELECT Length (' Ye Dehua ABC ') from dual;
Results:
--length by character, Chinese, English, numbers are 1 characters, so here return 6
3. LENGTHB represents the byte length of the string;
SELECT LENGTHB (' Ye Dehua ABC ') from dual '
Results:
--length in bytes, I here is UTF-8 encoding, Kanji 3 bytes, English one byte, so here return 12

4, substr means to obtain the substring according to the character length,
SELECT substr (' Ye Dehua abc ', 1,4) from dual;
Results:
--substr by character Intercept, intercept to A, return: Ye Dehua A

5. SUBSTRB means to get a string based on the length of the byte.
SELECT substrb (' Ye Dehua ABC ') from dual;
Results:
--SUBSTRB by Byte, 2 less than one Chinese character length, return: two spaces
SELECT substrb (' Ye Dehua abc ', 1,3) from dual;
--SUBSTRB by Byte intercept, 3 is just a Chinese character length, return: Leaf select SUBSTRB (' Ye Dehua abc ', 1,4) from dual;
--SUBSTRB by Byte, 4 extra kanji less than two kanji, return: contra a space




Replace, length, LENGTHB, substr, SUBSTRB functions in Oracle

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.