从Oracle上的给定位置删除字符 [英] Remove a character from a given position on Oracle
本文介绍了从Oracle上的给定位置删除字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
反正有没有从给定位置删除字符?
Is there anyway to remove a character from a given position?
比方说我的话是: 薄煎饼 而且我想删除第二个字母(在这种情况下为"A"),所以我希望返回PNCAKES.
Let's say my word is: PANCAKES And I want to remove the 2nd letter (in this case, 'A'), so i want PNCAKES as my return.
翻译对此无效. 替换对此不起作用. 正则表达式太复杂了...
Translate doesnt work for this. Replace doesnt work for this. Regex is damn complicated...
想法?
推荐答案
示例:
SUBSTR('PANCAKES', 0, INSTR('PANCAKES', 'A', 1, 1)-1) || SUBSTR('PANCAKES', INSTR('PANCAKES', 'A', 1, 1)+1)
我没有要测试的Oracle实例,可能必须调整-1/+ 1才能获得正确的位置.
I don't have an Oracle instance to test with, might have to tweak the -1/+1 to get the position correct.
参考文献:
- INSTR
- SUBSTR
- Concatenating using pipes "||"
这篇关于从Oracle上的给定位置删除字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文