当前位置:网站首页>Explanation and application of instr() function in Oracle
Explanation and application of instr() function in Oracle
2022-06-28 07:44:00 【Zeiyalo】
from : Click here to see the author
1)instr() Format of function ( Be commonly called : Character lookup function )
INSTR( string, substring [, start_position [, th_appearance ] ] )
Parameters :
string - String to search . The string can be CHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB or NCLOB Other types .
substring - In the string (string) Substring searched in . The substring can be CHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB or NCLOB Other types .
start_position - Optional . Position in the string where the search will begin . If omitted , The default is 1. The first position in the string is 1. If start_position It's a negative number ,INSTR The function evaluates from the end of the string start_position Number of characters , Then search the beginning of the string .
nth_appearance - Optional . The second part of the substring n One appears . If omitted , The default is 1.
Return value
Returns a numeric value . The first position in the string is 1. If not found in the string substring, that INSTR Function will return 0.
Format 1 :instr( string1, string2 ) / instr( The source string , Target string )
Format two :instr( string1, string2 [, start_position [, nth_appearance ] ] ) / instr( The source string , Target string , The starting position , Match serial number )
analysis :string2 The value of should be in string1 Search for , It's from start_position The values given ( namely : Location ) Start in string1 retrieval , Search page nth_appearance( A few ) time string2.
notes : stay Oracle/PLSQL in ,instr Function returns the position of the string to be intercepted in the source string . Search only once , That is to say, from the beginning of a character to the end of a character .
example :
1. Format 1:
1 select instr('helloworld','l') from dual; -- Return results :3 By default, it appears for the first time “l” The location of
2 select instr('helloworld','lo') from dual; -- Return results :4 namely : stay “lo” in ,“l” Where it started to appear
3 select instr('helloworld','wo') from dual; -- Return results :6 namely “w” Where it started to appear
2. Format 2:
1 select instr('helloworld','l',2,2) from dual; -- Return results :4 in other words : stay "helloworld" Of the 2(e) No. 1 position starts , Look for the second time “l” The location of
2 select instr('helloworld','l',3,2) from dual; -- Return results :4 in other words : stay "helloworld" Of the 3(l) No. 1 position starts , Look for the second time “l” The location of
3 select instr('helloworld','l',4,2) from dual; -- Return results :9 in other words : stay "helloworld" Of the 4(l) No. 1 position starts , Look for the second time “l” The location of
4 select instr('helloworld','l',-1,1) from dual; -- Return results :9 in other words : stay "helloworld" The last of 1(d) No. 1 position starts , Go back and look for the first time “l” The location of
5 select instr('helloworld','l',-2,2) from dual; -- Return results :4 in other words : stay "helloworld" The last of 1(d) No. 1 position starts , Look back for the second time “l” The location of
6 select instr('helloworld','l',2,3) from dual; -- Return results :9 in other words : stay "helloworld" Of the 2(e) No. 1 position starts , Look for the third time “l” The location of
7 select instr('helloworld','l',-2,3) from dual; -- Return results :3 in other words : stay "helloworld" The last of 2(l) No. 1 position starts , Go back and look for the third time “l” The location of
边栏推荐
- kubernetes集群命令行工具kubectl
- Software design of resistance test board
- flex布局
- Mysql57 zip file installation
- What is EC blower fan?
- 数字藏品市场“三大套路”
- Implementation of commit message standardized control in large projects
- Open62541 import nodeset file directly
- Kubelet garbage collection (exiting containers and unused images) source code analysis
- Drawing animated bubble chart with R language
猜你喜欢

8 张图 | 剖析 Eureka 的首次同步注册表

2021 programming language ranking summary

剑指Offer||:链表(简单)

Kubelet garbage collection (exiting containers and unused images) source code analysis

linux下修改mysql用户名root

HJ质数因子

异或的应用。(提取出数字中最右侧的1,面试中经常用的到)

Sword finger offer|: linked list (simple)

asp. Net registration page

分析 NFT 项目的 5 个指标
随机推荐
Unity UI shadow component
扩展Prometheus的解决方案thanos的简介和几个月使用心得
HJ质数因子
Dataset filling data, and the use of rows and columns
Section VI UART of zynq
HJ进制转换
阿里云服务器创建快照、回滚磁盘
asp. Net registration page
腾讯下半年继续裁员,所有事业群至少缩减 10%,对此你怎么看?关注者
flex布局
Section 5: zynq interrupt
Es data export CSV file
QT -- communication protocol
MMR rearrangement (similarity is calculated by editing distance and repeatability)
How to configure DDR3 of dm8148
R language Kolmogorov Smirnov tests whether the two samples follow the same distribution.
Alibaba cloud server creates snapshots and rolls back disks
kubernetes集群命令行工具kubectl
Solving the longest palindrome substring by dynamic programming
Hash slot of rediscluster cluster cluster implementation principle