[英]Oracle: What's the difference between NULL and <null>?
我嘗試在Google中尋找答案,但未找到任何結果,可能是因為尖括號。 我知道NULL
含義,但是<null>
的目的是什么?
<null>
不是oracle語法的一部分,它可能由您的IDE或控制台用來在查詢結果中打印出空值。 空值的唯一有效表示實際上是NULL
。 試試看:
-- OK:
select NULL from dual
-- Syntax error:
select <null> from dual
-- Syntax OK, but not a null value:
select '<null>' from dual
在Sql中,將null
視為一個未知值,您可以將其表示為null
,但不能將其表示為<null>
,將<null>
視為字符串,並且如果您給<null>
不帶單引號,它將為您提供缺少的表達式錯誤,因為它具有<
& >
常用關系運算符。
因此, <null>
和null
沒有關系。
一些可解決的問題可以增進您的理解,
select null col from dual; -- Gives 1 row.
select <null> col from dual; -- Missing expression Error
select * from (select 'null' col from dual) where col is null; -- Gives no records
select * from (select '<null>' col from dual) where col is null; -- Gives no records
select * from (select null col from dual) where col is null; -- Returns 1 row
溫馨提示:在stackoverflow中,您不能鍵入/顯示<null>
而不是作為代碼示例:)。 回答此問題時觀察到。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.