INSTR and SUBSTR methods in Oracle

Source: Internet
Author: User
Tags oracle substr
The format of the INSTR method is INSTR (source string, target string, start position, matching serial number), for example: INSTR (

The format of the INSTR method is INSTR (source string, target string, start position, matching serial number), for example: INSTR (

The format of the INSTR method is
INSTR (source string, target string, start position, matching serial number)

For example, in INSTR ('upgrade FLOOR ', 'or', 3, 2), the source string is 'upgrade FLOOR', the target string is 'or', And the start position is 3, take the location of 2nd matching items.

The default search order is left to right. When the start position is negative, search from the right.

Therefore, the result of select instr ('upgrade FLOOR ',' OR ',-1, 1) "Instring" from dual is:

Instring
------
14


Oracle substr function usage
Obtain the string substr (string, start_position, [length]) with the specified start position and length in the string.
For example:
Substr ('this is a test', 6, 2) wowould return 'is'
Substr ('this is a test', 6) wocould return 'is a Test'
Substr ('techonthenet ',-3, 3) wocould return 'net'
Substr ('techonthenet ',-6, 3) wocould return The 'select substr ('thisatest',-4, 2) value from dual

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.