Detailed description of oracleinstr () function usage

Source: Internet
Author: User
This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.

This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.

This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.

Syntax

The Code is as follows:

Instr (string1, string2 [, start_position [, nth_appearance])


String1 is the string to be searched.

String2 is the search substring in string1.

Start_position is the start position of the search in string1. This parameter is optional. If omitted, the default value is 1. The first position in the string is 1. If start_position is a negative number, the function searches for strings starting from string1, and then returns start_position to the number of characters in the ending count.

The Nth appearance of nth_appearance string2. This is optional. If omitted, the default value is 1.

Note:

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

Applies:

The Code is as follows:

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

Instance

The Code is as follows:
Instr ('tech on the net', 'E') wocould return 2; the first occurrence of 'E'
Instr ('tech on the net', 'E', 1, 1) wocould return 2; the first occurrence of 'E'
Instr ('tech on the net', 'E', 1, 2) wocould return 11; the second occurrence of 'E'
Instr ('tech on the net', 'E', 1, 3) wocould return 14; the third occurrence of 'E'
Instr ('tech on the net', 'E',-3, 2) wowould return 2.

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.