Oracle function--instr ()

Source: Internet
Author: User


InStr () returns the position of the string to be intercepted in the source string

Grammar:
InStr (Sourcestring,deststring,startposition,appearposition)

Parameter description:

Sourcestring: The source string to find in this string.

Deststring: The string to find in the sourcestring.

StartPosition: represents where to start the lookup in the sourcestring string. This parameter is optional if the default of 1 is ignored. If this parameter is a positive number, it is retrieved from left to right. If negative, retrieves from right to left. Returns the index position of the lookup string in the source string.

Appearposition: Represents the first occurrence of the deststring, this parameter can be ignored, the default is 1, set negative number will be an error.

If deststring is not found in Sourcestring, 0 is returned.

Both sourcestring and deststring can is any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned is of number datatype.

--Returns the position of the string to be intercepted in the source string
Select InStr (' abc ', ' A ') from dual; --Return 1
Select InStr (' abc ', ' BC ') from dual; --Return 2
Select InStr (' AB c abc ', ' A ', 1,2) from dual; --Return 6
Select InStr (' Uoabc ', ' BC ', -1,1) from dual; --Return 4
Select InStr (' abc ', ' d ') from dual; --Return 0


Extensions: INSTRB (), INSTRC (), INSTR2 (), INSTR4 ()






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.