select even column is null oracle

本文关键字:null oracle is column even select | 更新日期: 2023-09-27 18:06:09

下面是我的SQL select命令;

sqlcommand = "SELECT * FROM INVENTORY WHERE LOWER(SAPNO) LIKE LOWER('" + sapNo + "%') AND LOWER(PARTDESC) LIKE LOWER('" + partDesc + "%') AND LOWER(PARTNO) LIKE LOWER('" + partNo + "%') AND MINQTY = '" + minQty + "' AND QOH = '" + QOH + "' AND LOWER(CATEGORY) LIKE LOWER('" + category + "%') AND LOWER(EQUIPMENT) LIKE LOWER('" + equipment + "%')";

例如类别和设备确认为空。剩下的有价值。我怎么能选择行,即使类别和设备是空的?因为每当设备和类别为null时,我都会使用此注释,因此数据不会显示!

非常感谢您的评论!!TQ

select even column is null oracle

您可以添加一些OR条件,以便返回可以具有特定值null的行。

AND (LOWER(CATEGORY) LIKE LOWER('" + category + "%') OR CATEGORY IS NULL) AND (LOWER(EQUIPMENT) LIKE LOWER('" + equipment + "%') OR EQUIPMENT IS NULL)