是不是固定就这样的格式? 没有其他特殊字符吧?试试这样:SQL> SELECT replace(substr('{dffgf:fdfdf}',instr('{dffgf:fdfdf}',':')+1),'}','') FROM dual;REPLACE(SUBSTR('{DFFGF:FDFDF}' ------------------------------ fdfdfSQL>
前面有其他字符没关系,关键是b字符串后紧跟},然后就结束。 SQL> SELECT replace(substr('${a:b}',instr('${a:b}',':')+1),'}','') FROM dual;REPLACE(SUBSTR('${A:B}',INSTR( ------------------------------ bSQL>
前后还有其他的字符串,比如 adasd${a:b}asdasd
SQL> WITH temp AS ( 2 SELECT substr('adasd${a:b}asdasd',instr('adasd${a:b}asdasd',':')+1) superstr FROM dual) 3 SELECT substr(superstr,1,instr(superstr,'}')-1) FROM temp;SUBSTR(SUPERSTR,1,INSTR(SUPERS ------------------------------ bSQL>
没有其他特殊字符吧?试试这样:SQL> SELECT replace(substr('{dffgf:fdfdf}',instr('{dffgf:fdfdf}',':')+1),'}','') FROM dual;REPLACE(SUBSTR('{DFFGF:FDFDF}'
------------------------------
fdfdfSQL>
SQL> SELECT replace(substr('${a:b}',instr('${a:b}',':')+1),'}','') FROM dual;REPLACE(SUBSTR('${A:B}',INSTR(
------------------------------
bSQL>
2 SELECT substr('adasd${a:b}asdasd',instr('adasd${a:b}asdasd',':')+1) superstr FROM dual)
3 SELECT substr(superstr,1,instr(superstr,'}')-1) FROM temp;SUBSTR(SUPERSTR,1,INSTR(SUPERS
------------------------------
bSQL>
1,
instr(substr('adasd${a:b}asdasd',instr('adasd${a:b}asdasd',':')+1),'}')-1)FROM dual;
SELECT rtrim(ltrim(regexp_substr('${a:b}', ':(.*)}'), ':'), '}') FROM dual;