筋斗云@ 2020-06-15 19:59 采纳率: 0%
浏览 147

求解! 新手求学 这个结果不应该是一条数据吗count(*) =3 ,为什么会是多条数据呢?

create or replace function emp_count(v_deptno number)
return number
is
v_count number;
begin
select count(*) into v_count from emp
where deptno = v_deptno;
return v_count;
end;

  • 写回答

1条回答 默认 最新

  • 向阳的花儿 2020-06-18 17:12
    关注

    你这个返回的是一个表;
    你要创建的函数应该是要返回一个值对吧(标量函数)
    写的时候要改成

    select v_count=count(*)   from emp
    where deptno = v_deptno;
    
    
    评论

报告相同问题?