将 NULL 替换为空白值 OS400
我试图让我的结果设置为空白而不是空,我尝试了
凝聚 当'y'然后hhhinvn''' 结尾为“信用备忘录号”,
I am trying to get my result set to return a blank rather than NULL, I have tried COALESCE but just cannot seem to get this to work, here is that section of my query:
CASE HHHCRIN
WHEN 'Y' THEN HHHINVN ELSE ''
END AS "Credit Memo Document Number",
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须首先使用 COALESCE 命令来列出空值,然后在生成的 COALESCE 新列中包含 CASE 命令,以将空值替换为空白
You have to start with the COALESCE command first to list your nulls, then include a CASE command to your resulting COALESCE new column to replace your nulls with blanks
Cocece左至右工作,并将您的第一个非零事物归还了该顺序;
“如果名称为null,请尝试地址,如果地址为null,请尝试'未知值' - 和'未知值'绝对不是null”,
对于下表:
COALESCE works left to right and returns you the first non null thing encountered in that order;
"If name is null, try address, if address is null, try 'unknown value' - and 'unknown value' is definitely not null"
For the following table: