SQL 从sql plus中的字符串中删除最后一个字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26465848/
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 last character from string in sql plus
提问by Ali Anwar
I'm trying to remove the last character from a column output in sql plus. The length of the column entries is not fixed
我正在尝试从 sql plus 的列输出中删除最后一个字符。列条目的长度不固定
For e.g XYZA should output as XYZ
例如 XYZA 应该输出为 XYZ
I've tried using the substr()
function but it doesn't seem to work.
我试过使用该substr()
功能,但它似乎不起作用。
SUBSTR(ooo.CO_NAME,1,LENGTH(ooo.CO_NAME-1))
回答by Troy Gizzi
A closing parenthesis is in the wrong place. It should be:
右括号在错误的位置。它应该是:
SUBSTR(ooo.CO_NAME, 1, LENGTH(ooo.CO_NAME) - 1)