@aslangeri sanırım bahsedilen..
Kod: Tümünü seç
select * from table where degisken is null
veya
Kod: Tümünü seç
select * from table where degisken is not null
daki is null değil.
Fonksiyon olarak ISNULL(alan, dönecek_değer) genel formatındaki
isnull. Burada alan ın değeri
null olursa başka bir değer döndürülebilir.. Daha önce konuşuldu ISNULL() fonksiyonu MS-SQL ve SYBASE de kullanılmaktadır. Fakat FireBird de bu işi;
Kod: Tümünü seç
select urun_no, ad, miktar * COALESCE(satis_fiyati, 0) from urun
Kod: Tümünü seç
select urun_no, ad, COALESCE(satis_fiyati, 'sıfır') from urun
örneklerindeki
COALESCE(alan_değişken, dönecek_değer) ile yapabiliriz..
Ayrıca;
Kod: Tümünü seç
select urun_no, ad, case when satis_fiyati is null then 'sıfır' else satis_fiyati end from urun
veya
Kod: Tümünü seç
select urun_no, ad, case when satis_fiyati is null then 0 else satis_fiyati end from urun
yapısını kullanarak FireBird de değişik varyasyonlar yapmak mümkündür
Ayrıca aşağıdaki yapıda bir de NULLIF() fonksiyonu var;
c) NULLIF
Returns NULL for a sub-expression if it has a specific value, otherwise returns the value of the sub-expression.
Format
<case abbreviation> ::=
NULLIF <left paren> <value expression> <comma> <value expression> <right paren>
Syntax Rules
NULLIF (V1, V2) is equivalent to the following <case specification>:
CASE WHEN V1 = V2 THEN NULL ELSE V1 END
Example
UPDATE PRODUCTS
SET STOCK = NULLIF(STOCK,0)