900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > Oracle 与 Mysql NULL值 空字符串''的区别

Oracle 与 Mysql NULL值 空字符串''的区别

时间:2022-02-23 11:14:04

相关推荐

Oracle 与 Mysql NULL值 空字符串''的区别

Oracle(null等同于空字符'')

1.oracle插入空字符串默认替换成null

2.oracle查询(null和被替换的空字符)时使用 is null/is not null

3.使用聚合函数时自动忽略null值

Mysql(null不等同于空字符'')

1.mysql插入null显示为null,插入空字符串显示空

2.null查询用 is null/is not null,空字符''查询用 =''/<>''

3.使用聚合函数时自动忽略null值

mapping.xml:

<if test='desc1!=null '>

<choose>

<when test='desc1!="" '>

and A.DESC1 = #{desc1}

</when>

<otherwise>

and (A.DESC1 is null or A.DESC1 = '')

</otherwise>

</choose>

</if>

java逻辑:

if desc1 !=null{

switch(s):

case desc1!="":and A.DESC1 = #{desc1}

default:A.DESC1 is null or A.DESC1 = ''

}else{

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。