Oracle InStr () Functional usage Detailed

Source: Internet
Author: User

Grammar

The code is as follows Copy Code

InStr (string1, string2 [, Start_position [, Nth_appearance]])


String1 is the string to search for.

string2 searches for substrings in string1.

Start_position is where the search will begin in string1. This parameter is optional. If omitted, the default is 1. The first position in the string is 1. If the start_position is a negative number, the function searches for the string from the beginning of the string1, and then start_position the characters for the end count.

Nth_appearance string2 's nth appearance. This is optional. If omitted, the default is 1.

Attention:

If string2 is found in string1, then the InStr Oracle function returns 0.

Applies To:

The code is as follows Copy Code

Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g

Instance

  code is as follows copy code
instr (' Tech on The net ', ' E ') would return 2; The "occurrence" of ' E '
InStr (' Tech on ', ' E ', 1, 1) would return 2; the ' E '
Occurrence R (' Tech on the net ', ' e ', 1, 2) would return 11; The second occurrence of ' E '
InStr (' Tech on ", ' E ', 1, 3) would return;" Third occurrence of ' e '
in STR (' Tech on the net ', ' e ', -3, 2) would return 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.