用空值更新列

编程入门 行业动态 更新时间:2024-10-28 09:20:06
本文介绍了用空值更新列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试如下更新表:

update userloginstats set logouttime = sysdate where logouttime = null;

它没有用空值更新列.出了什么问题?

It didn't update the columns with null values. What went wrong?

推荐答案

将其更改为

...where logouttime is null; ^^^^^^^

NULL是一个特殊值,我们不能将其与通常的=运算符一起使用.

NULL is a special value and we cannot use the usual = operator with it.

从有关NULL的Oracle文档 :

要测试是否为空,请仅使用 比较条件IS NULL和IS NOT NULL.如果您使用任何其他带有null的条件,并且结果取决于null的值,则结果为UNKNOWN,因为null表示缺少数据,null 不能等于或不等于任何值,或者改成另一个null

To test for nulls, use only the comparison conditions IS NULL and IS NOT NULL. If you use any other condition with nulls and the result depends on the value of the null, then the result is UNKNOWN because null represents a lack of data, a null cannot be equal or unequal to any value or to another null

更多推荐

用空值更新列

本文发布于:2023-10-20 09:17:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1510561.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用空值

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!