Pragma to Hide Warning: where 条件中使用的字段可能包含空值 [英] Pragma to Hide Warning: the field used in the where condition may contain null values

查看:38
本文介绍了Pragma to Hide Warning: where 条件中使用的字段可能包含空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个编译指示,我可以用它来隐藏在选择的 WHERE 条件中使用的字段可能包含数据库中的 NULL 值时生成的编译器警告.

I'm looking for a pragma I can use to hide the compiler warning generated when a field used in the WHERE condition of a select may contain NULL values in the database.

阅读 SAP 说明 1088403 后,我知道这里可能存在的问题,但我无法应用那里建议的解决方案,因为我使用的是范围,而不是 WHERE 子句中的单个值.在任何一种情况下,这是从未被发现有缺陷的遗留代码(据我们所知),很快就会被替换.

Having read SAP note 1088403, I am aware of the possible issues here but I cannot apply the solutions suggested there since I'm using a range, not a single value in the WHERE clause. In either case this is legacy code that was never found to be defective (as far as we know) and will be replaced before long.

但是,当我重写程序的其他部分时,我想使用 pragma.谁能告诉我我可以为此使用什么编译指示?

However while I'm rewriting other sections of the program, I'd like to disable this warning with a pragma. Could anyone tell me what pragma I'd be able to use for this?

示例选择:

SELECT d~matnr d~werks d~lgort d~bdmng k~maktx
INTO CORRESPONDING FIELDS OF TABLE itab
FROM resb AS d
INNER JOIN makt AS k ON d~matnr = k~matnr
WHERE
    k~spras = syst-langu
    AND d~werks = p_werks
    AND d~matnr IN s_matnr
    AND d~bwart IN r_bwart.

请注意,我已经使用动态 where 子句替换了这个选择,这也隐藏了警告,因为编译器显然无法检查基于文本的 where.

Note that I've since replaced this select with one using a dynamic where clause which also hides the warning since the compiler obviously can't check a text-based where.

推荐答案

如果您对包含此代码段的程序运行扩展语法检查,您将看到它明确指出没有抑制此的编译指示(重点是我的):

If you run the extended syntax check over a program with this snippet in, you will see that it specifically states there is no pragma to suppress this (emphasis mine):

程序:<程序名称>行:<行>
语法检查警告
WHERE 条件中使用的字段BWART"可能包含 NULL 值.
内部消息代码:MESSAGE GYT
不能使用编译指示或伪注释抑制

这篇关于Pragma to Hide Warning: where 条件中使用的字段可能包含空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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