删除 Oracle Server 中字符串的第一个字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34889535/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove first characters of string in Oracle Server
提问by netraider
I have Table1.column1
in a Oracle Server with text such as 12345678910
.
我Table1.column1
在 Oracle Server 中使用了诸如12345678910
.
How can I remove the first six characters of the string? The result should be 78910
.
如何删除字符串的前六个字符?结果应该是78910
。
回答by MT0
SELECT SUBSTR( column1, 7, LENGTH( column1 ) - 6 )
FROM Table1;
or more simply:
或更简单地说:
SELECT SUBSTR( column1, 7 )
FROM Table1;
回答by Bob Jarvis - Reinstate Monica
If you know you want the last five characters of a string you can use a negative value for the second argument to SUBSTR
, as in:
如果您知道需要字符串的最后五个字符,则可以对 的第二个参数使用负值SUBSTR
,如下所示:
select substr('12345678910', -5) from dual;
which produces '78910'
.
产生'78910'
.
Best of luck.
祝你好运。
回答by Rahul
Have you tried using SUBSTR()
function like
您是否尝试过使用SUBSTR()
类似的功能
select substr(column1, 6, 5)
from Table1;