用replace , 将空格替换成‘’,就是空的,
然后跟原先的字符长度比较, 得出的就是字符串的个数。
嘿嘿~ 刚刚想到的。 

select id, len(nr) - len(replace(nr,' ' , '') ) 
from temp