当前位置:网站首页>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 deploys a secret pit where thanos ruler sends repeated alarms
- In idea, the get and set methods may be popular because the Lombok plug-in is not installed
- Design of DSP image data stream
- Safety training is the greatest benefit for employees! 2022 induction safety training for new employees
- Kubelet garbage collection (exiting containers and unused images) source code analysis
- Redis one master multi slave cluster setup
- asp. Net registration page
- open62541直接导入NodeSet文件
- 本周二晚19:00战码先锋第8期直播丨如何多方位参与OpenHarmony开源贡献
- kubernetes删除pod的流程的源码简析
猜你喜欢
Porting ucosiii to stm32f429
腾讯下半年继续裁员,所有事业群至少缩减 10%,对此你怎么看?关注者
Software design of resistance test board
Kubernetes理论基础
kubelet驱逐机制的源码分析
What is EC blower fan?
Spark 离线开发框架设计与实现
No suspense about the No. 1 Internet company overtime table
Application and Optimization Practice of redis in vivo push platform
剑指Offer||:链表(简单)
随机推荐
How to configure DDR3 of dm8148
Solving the longest palindrome substring by dynamic programming
golang gin框架进行分块传输
[thanos source code analysis series]thanos query component source code analysis
goland IDE和delve调试位于kubernetes集群中的go程序
Porting ucosiii to stm32f429
[ thanos源码分析系列 ]thanos query组件源码简析
Tencent continued to lay off staff in the second half of the year, and all business groups reduced by at least 10%. What do you think of this? Followers
Evaluation of inverse Polish expression < difficulty coefficient >
SOC serial port configuration
Understanding of OPC protocol
Path alias specified in vite2.9
A single node obtains the lock lock of the order number
HJ character count
数字藏品市场“三大套路”
Hash slot of rediscluster cluster cluster implementation principle
Helloword routine for ROS
Sentinel mechanism of redis cluster
es数据导出csv文件
vite2.9 中指定路径别名