当前位置:网站首页>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
边栏推荐
- Es data export CSV file
- R language ggmap visual cluster
- HJ prime factor
- Uninstall and reinstall the latest version of MySQL database. The test is valid
- 7-2 Finnish wooden chess structure Sorting
- Ice - resources
- R language ggmap
- 卸载重装最新版mysql数据库亲测有效
- es6箭头函数中return的用法
- What is the lifecycle of automated testing?
猜你喜欢

SOC timer and interrupt configuration

asp. Net registration page

kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑

2021 programming language ranking summary

Path alias specified in vite2.9

腾讯下半年继续裁员,所有事业群至少缩减 10%,对此你怎么看?关注者

GoLand IDE and delve debug Go programs in kubernetes cluster

linux下修改mysql用户名root

Unity UI shadow component

In idea, the get and set methods may be popular because the Lombok plug-in is not installed
随机推荐
剑指Offer||:链表(简单)
Alibaba cloud server creates snapshots and rolls back disks
Code submission specification
一个小工具可以更快的写爬虫
Spark 离线开发框架设计与实现
kubelet垃圾(退出的容器和未使用的镜像)回收源码分析
Hj21 simple password
R and RGL draw 3D knots
打新债注册开户靠谱吗?安全吗?
Understanding of OPC protocol
What is the lifecycle of automated testing?
什么是EC鼓风机(ec blower fan)?
flex布局
8 figures | analyze Eureka's first synchronization registry
ACM notes
HJ prime factor
网传互联网公司加班表,排名第一的没悬念
扩展Prometheus的解决方案thanos的简介和几个月使用心得
在idea中,get和set方法爆红可能是没有安装Lombok插件
flex布局