Oracle nal() 和count(*)的注意点

select count(*) into fhave from tab_ppxuser where name = userstr;

select nvl(hphotourl, '0') into photourl from tab_ppxuser where name = userstr;
这两条指令的方法count(*)和nvl(a,b)必须分开写,不然会报错,

方法nal()有两个参数,如nvl(a,b)
a时表的列元素名,b是个替代数据,理论上可以任意数据类型,可是我建议用varchar2的字符串,
当查询a返回的结果为null时,将会用b来赋值给结果,这样就可以避免了null返回值
posted @ 2019-03-15 00:43  岑惜  阅读(984)  评论(0)    收藏  举报