在oracle中如果某個字段有空值,在和其他字段相加的時候會使得結果也爲空,這個時候需要令null默認變爲0(或其他指定的數值
select nvl(S_PLEDGE_SHARES,0) + nvl(S_FRO_SHARES,0) from AEquFroPleInfoRepperend where price_date=20190930 and s_info_windcode='300065.SZ'
- nvl 函數的第一個參數爲字段名稱,第二個參數爲默認值
select nvl(S_PLEDGE_SHARES,0) + nvl(S_FRO_SHARES,0) from AEquFroPleInfoRepperend where price_date=20190930 and s_info_windcode='300065.SZ'