Oracle Database Basics _ String Operations related 2

Source: Internet
Author: User

6.lpad,rpad
Function: The left/right string fills some specific characters
Syntax: Lpad (String, n, [pad_string])
String: But the character or argument
N: The length of the character, is the number of strings returned, if this number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character; Pad_string: is an optional parameter, this string is to be pasted to the left of the string, if this argument is not written, the Lpad function will paste a space on the left side of the string.

For example

SELECT Lpad ('aaaaaaaa',5,'$') from DUAL;
Data result: AaaaA

Output Result: AaaaA

7.SUBSTR
Function: A string used to intercept strings. Returns the n characters from the start of the M bit in a char
(if m=0, start at the beginning of the string and, if negative, start at the tail)
Syntax: SUBSTR (char,m,n)
For example

selectsubstr ('Hello world! ', 7,' fromDUAL;

Output Result: world!
PS: The first count of strings starts at 1.

8.INSTR
Syntax: INSTR (char1,char2,m,n)
Function: Returns the position of the nth occurrence of the substring char2 in char1 starting from M
For example:

SELECT ('helloWorld','World ',6,2   from DUAL;

Output results: 13
PS: Parameter n can not lose, then default first occurrence position

For a moment, record the above 8 operations, and then add them later.

Oracle Database Basics _ String Operations related 2

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.