在oracle中,可以利用is關(guān)鍵字判斷數(shù)據(jù)是否為空,因?yàn)閚ull在sql中被看作特殊符號(hào),所以不能使用等號(hào),語(yǔ)法為“select * from table where column is null”。
本教程操作環(huán)境:Windows10系統(tǒng)、Oracle 11g版、Dell G3電腦。
oracle怎樣判斷數(shù)據(jù)是否為空
oracle判斷一個(gè)字段為空
比如
insert into table a (a1,b1)values("a1",'');
對(duì)于這種情況,因?yàn)楸砝锎娴氖?#39;',其實(shí)是沒(méi)有內(nèi)容的,要查詢(xún)這個(gè)字段,不能直接使用
select * from a where b1='';
sql中判斷非空不能用等號(hào),因?yàn)閚ull在sql中被看作特殊符號(hào),必須使用關(guān)鍵字 is和not
應(yīng)該如此使用:
select * from A where b1 is null
或者:
select * from A where b1 is not null
推薦教程:《Oracle教程》