简体   繁体   English

长度(列)大于字符,但后跟空格

[英]Length (column) greater than but spaces after the characters

I have this query to show all records where column is greater than 4 characters, however, the data contains spaces after the characters for example '1234 ' . 我有这个查询来显示列大于4个字符的所有记录,但是,数据在字符之后包含空格,例如'1234'。

How could I modify the below query to ignore the spaces after the characters? 如何修改以下查询以忽略字符后的空格? Querying an Oracle database. 查询Oracle数据库。

Many thanks. 非常感谢。

select * 
from tablename
where length(field1) > 4

You can use rtrim function to remove the trailing spaces. 您可以使用rtrim函数删除尾随空格。

select * 
from tablename 
where length(rtrim(field1)) > 4

Perhaps you want to check ltrim , trim functions, too. 也许您也想检查ltrimtrim功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @Column长度大于255个字符的实体 - Entity with @Column length greater than 255 characters SQL - 列字符串字符必须大于25 - SQL - Column string characters has to be greater than 25 当插入的值大于列长度时,将错误的值插入SQL Server表 - Incorrect value inserted into SQL server table when inserted value is greater than column length 如何找到列名长度大于5的所有列? - How can I find all columns where the column name length is greater than 5? 修剪数据集中前导0的长度大于x - Trim leading 0 for length greater than x in a dataset 如果字符串长度大于2,则选择“仅列” - Select Columns Only if String length is greater than 2 SQL查询,其中列包含数字,逗号或空格以外的字符 - SQL query where column has characters other than numbers or commas or spaces 定义VARCHAR2列的长度更大的影响 - Impact of defining VARCHAR2 column with greater length 如果列大于某个值,则更新列 - UPDATE column if column is greater than a value 如何拆分一个句子并在一列上只剩下 15 个或更少(不大于 15)个字符,但最后它可能是一个完整的单词 - How to split a sentence and get only left 15 or less (Not greater than 15) characters on one column but at the end it could be a complete word
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM