本文介绍了哪一个代表空值? undef或空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在表的列中插入null
.
哪个代表空值? undef
或空字符串''
.
Which one represents null? undef
or empty string ''
.
应该使用哪个?为什么?我知道defined
并且可以检查.
Which one should be used and Why? I know about defined
and that I can check it.
但是我从数据库的角度看更多.
But I am looking more from perspective of database.
哪个人更恰当地表示null
?
更新:我正在使用DBI
模块.
推荐答案
DBI使用undef
表示SQL NULL
.空字符串代表空字符串.
DBI uses undef
to represent a SQL NULL
. The empty string represents an empty string.
但是,某些数据库不能区分NULL
和空字符串. Oracle在这里是一个特别的冒犯者. DBI对此无能为力.
However, some databases don't make a distinction between NULL
and the empty string. Oracle is a particular offender here. DBI can't do anything about that.
这篇关于哪一个代表空值? undef或空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!