【发布时间】:2015-11-16 11:08:15
【问题描述】:
我在 Table(Oracle) 中有一个 Number 字段,如下所示
TEST_HOURS NUMBER(10,2)
当我尝试以下 SQL 时它不起作用
select t.test_hours from test_hours t where
where (t.test_hours != 1 or t.test_hours is not null)
and t.id = 11
当我删除此(t.test_hours != 1 or t.test_hours != null) 时,它工作正常,但当我包含上述行时,它不会获取数据并且没有error。
有人可以帮我解决这个问题吗?
谢谢
【问题讨论】:
-
这种情况似乎毫无意义
t.test_hours != 1 or t.test_hours != null。你想得到什么? -
您无法与
null进行比较。始终使用is null或is not null。 -
@vkp 尝试不为空,它没有帮助
-
@EgorSkriptunoff 我正在尝试检查 test_hours 的值是否为 1,如果它的值为 1,则如果不获取该行,则不获取该行,我将传递我给出的测试值动态有价值但没有帮助
标签: sql database oracle numbers conditional-statements