Oracle substitution for charindex function in SQL Server?

Source: Internet
Author: User

Instr (STR, CHR) --- location where CHR appears 1st times in Str

Instr (STR, CHR, 3rd) --- searches for the position where the CHR appears 2nd times in STR starting from the STR character position

Instr (STR, CHR,-3, 2) --- searches for the position where the CHR appears 3rd Times in STR from right to left.

Instr (C1, C2 [, <I> [, J])
C1 and c2 are strings, and I and j are integers. The function returns the position where C2 appears for the nth occurrence of C1, and searches for the position starting from the nth occurrence of C1. If no expected character is found, 0 is returned. If I is a negative number, the search proceeds from right to left, but the position is calculated from left to right, the default values of I and j are 1.
Select instr ('Mississippi ',' I ', 3, 3) from dual
Instr ('Mississippi ',' I ', 3, 3)
11

Select instr ('Mississippi ',' I ',-2, 3) from dual

Instr ('Mississippi ',' I ',-2, 3)
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.