oracle 不等于空判断无效

zhouyusunquan 2012-03-01 06:26:33
select * from CERTSTORAGE t where t.saleperson!=''
我数据中有一条saleperson有值,但是始终查询不到一条记录
...全文
3677 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
asdf3309 2013-08-19
  • 打赏
  • 举报
回复
需要在''中加个空格,不然不行
桥边驿语人 2012-08-21
  • 打赏
  • 举报
回复
我也觉得是这样![Quote=引用 4 楼 的回复:]

空值没有大小,自然不能进行大于、小于、等于运算。
而只能进行is null,is not null的判定
[/Quote]
zhouyusunquan 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 minitoy 的回复:]

0长度字符串等同于null,不能直接用等号判断,要用is null判断
[/Quote]只是在oracle中是这样,sqlserver就能判断!=''
zhouyusunquan 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 hj_daxian 的回复:]

空字符就是null了

select * from CERTSTORAGE t where t.saleperson is not null 这样也查不到?
[/Quote]
这个你可是错了,空字符串不是空,空是什么都没有
云霄飞车 2012-03-06
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 x_blacke 的回复:]
空值没有大小,自然不能进行大于、小于、等于运算。
而只能进行is null,is not null的判定
[/Quote]
同意
简易人 2012-03-02
  • 打赏
  • 举报
回复
1、is null 为空;
2、is not null 不为空;
3、‘’空格不是空值。
liubo_1003 2012-03-02
  • 打赏
  • 举报
回复
我也遇到过这样的情况,你把* 去掉。写具体的列看看。
我上次select count(*) from table_name where hp is null,就是显示的0
后来改成select count(id) from table_name where hp is null,就显示1了!
liubo_1003 2012-03-02
  • 打赏
  • 举报
回复
is not null 不为空
is null 为空
mingchaoyan 2012-03-02
  • 打赏
  • 举报
回复
不等于 != 倒也可以,但按lz的意思 应该写成is not null
  • 打赏
  • 举报
回复
空字符就是null了

select * from CERTSTORAGE t where t.saleperson is not null 这样也查不到?
zhouyusunquan 2012-03-02
  • 打赏
  • 举报
回复
比如说,我所有数据都是空字符串,而不是空,t.saleperson!=''

也是查询不到的,
minitoy 2012-03-02
  • 打赏
  • 举报
回复
0长度字符串等同于null,不能直接用等号判断,要用is null判断
我是睡 2012-03-01
  • 打赏
  • 举报
回复
select * from CERTSTORAGE t where t.saleperson is not null
blacke 2012-03-01
  • 打赏
  • 举报
回复
空值没有大小,自然不能进行大于、小于、等于运算。
而只能进行is null,is not null的判定
xiaozhangnima 2012-03-01
  • 打赏
  • 举报
回复
不等!=和<>都可以
select * from CERTSTORAGE t where t.saleperson is not null or trim(t.saleperson)=''
youqi1984 2012-03-01
  • 打赏
  • 举报
回复
select * from CERTSTORAGE t where t.saleperson is not null
xpingping 2012-03-01
  • 打赏
  • 举报
回复
不等于是<>

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧