Oracle-使用前导或尾随空格查找值 [英] Oracle -- finding values with leading or trailing spaces

查看:66
本文介绍了Oracle-使用前导或尾随空格查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找某个列是否需要TRIM函数.

I am trying to find if a certain column requires TRIM function on it.

如何确定表中的此列是否包含在实际数据之前或之后具有空格的记录.

How can I find out if this column in a table has records that have white space either before or after the actual data.

推荐答案

您可以使用TRIM函数本身(不是最高效但最准确的函数)对其进行检查:

You can check it using the TRIM function itself, not the most efficient but accurate:

Select *
From TableA
Where MyColumn <> TRIM(MyColumn)

尽管如果要检查然后再转身进行修剪,则您可能想首先将其进行修剪,如下所示:

Though if you're checking then turning around to trim anyway, you probably want to just do it in the first place, like this:

Select TRIM(MyColumn) as TrimmedMyColumn
From TableA

这篇关于Oracle-使用前导或尾随空格查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆