Why does Oracle 9i treat an empty string as NULL?

后端 未结 10 1378
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 23:39

I know that it does consider \' \' as NULL, but that doesn\'t do much to tell me why this is the case. As I understand the SQL specifications

10条回答
  •  名媛妹妹
    2020-11-22 00:04

    Tom Kyte VP of Oracle:

    A ZERO length varchar is treated as NULL.

    '' is not treated as NULL.

    '' when assigned to a char(1) becomes ' ' (char types are blank padded strings).

    '' when assigned to a varchar2(1) becomes '' which is a zero length string and a zero length string is NULL in Oracle (it is no long '')

提交回复
热议问题