在Oracle中,CHAR类型的字段值会自动补足空格。所以当其作为条件时,就有可能查不出想要的数据。 如果不允许改DB设计的话,那
在Oracle中,CHAR类型的字段值会自动补足空格。所以当其作为条件时,就有可能查不出想要的数据。
如果不允许改DB设计的话,那就用RTRIM来解决吧。例:
DB:
测试代码:
输出结果(ORACLE):
而MySQL不会自动补足空格,同样的代码也是可以适用的:
输出结果(MySQL):
,
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn