[英]Trim null values in AS400
I am doing a join between two tables A and B on A.Item = B.Item. 我正在A.Item = B.Item的两个表A和B之间进行联接。 I am not getting the records as expected.
我没有得到预期的记录。 After doing some investigations, I saw that all the items in table B contains nulls at the end of the item.
经过一些调查,我发现表B中的所有项目在项目末尾都包含空值。
I would like to be able to do something like: 我希望能够执行以下操作:
SELECT * FROM A INNER JOIN B ON TRIMNULL(A.ITEM) = TRIMNULL(B.ITEM);
Is there any such method in AS400 to trim the null values? AS400中是否有任何此类方法可以修剪空值?
Take a look at the TRIM function in the manual. 看一下手册中的TRIM功能。 You can specify a character to trim.
您可以指定要修剪的字符。
If assuming you mean a hex x'00' when you say NULL. 如果假设您的意思是十六进制x'00',则您说NULL。 Then this should work:
然后这应该工作:
SELECT *
FROM A INNER JOIN B
ON TRIM(TRAILING x'00' FROM A.ITEM)
= TRIM(TRAILING x'00' FROM B.ITEM);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.