Instr functions in Oracle

Source: Internet
Author: User

The instr syntax is as follows:
Instr (string1, string2 [, start_position [, nth_appearance])

Function Description:
This function returns the position of string2 in string1.

Start_positionThe parameter indicates the number of characters starting from string1 to find string2. This parameter is optional. If omitted, the default value is 1. The default search sequence of the instr function is from left to right. If this parameter is a negative number, search for it from the right.

Nth_appearanceReturns the position of string2 for the first time. This parameter is optional. If omitted, the default value is 1, that is, the first occurrence of string2 is returned.

Example:
Select instr ('ate floor ',' or ',-1, 1) "AAA" from dual;

Aaa
---------- Search from the right. The first occurrence of 'or' in the original string starts with 14th characters.
14

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.