select count(*) into v_count from t_user
if v_count >0 then
........ end if;
当没有查到数据时,而你下面的sql代码中又用到这个v_count变量,有时就报"未找到数据"错误!解决办法就是异常处理。
begin
select count(*) into v_count from t_user
exception
when no_data_found then
v_count :=-1;
end;