Oracle中INSTR,SUBSTR方法
INSTR方法的格式为
INSTR(源字符串, 目标字符串, 起始位置, 匹配序号)
例如:INSTR('CORPORATE FLOOR','OR', 3, 2)中,源字符串为'CORPORATE FLOOR', 目标字符串为'OR',起始位置为3,取第2个匹配项的位置。
默认查找顺序为从左到右。当起始位置为负数的时候,从右边开始查找。
所以SELECT INSTR('CORPORATE FLOOR', 'OR', -1, 1) "Instring" FROM DUAL的显示结果是
Instring
——————
14
Oracle的substr函数的用法
取得字符串中指定起始位置和长度的字符串 substr( string, start_position, [ length ] )
如:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
substr('TechOnTheNet', -3, 3) would return 'Net'
substr('TechOnTheNet', -6, 3) would return 'The'select substr('Thisisatest', -4, 2) value from dual
相关推荐
tanrong 2020-04-20
softwear 2020-08-21
eroshn 2020-06-21
sunzhihaofuture 2020-06-21
luckymaoyy 2020-04-08
herohope 2020-03-27
liuyang000 2019-12-30
niuyisheng 2013-06-29
缘起宇轩阁 2019-12-21
云之飞踢 2019-12-18
heray0 2019-12-07
哆来咪er 2019-11-19
东辉在线 2019-11-05
resilient 2019-11-04