Select clausule inside pl/sql function return wrong value

前端 未结 1 1991
梦谈多话
梦谈多话 2021-01-29 09:33

When I do this:

select sum(m.mot)
from rmtq mq
join rmo m on mq.id = m.id
where mq.another = 138;

return value = 2, which is correct. But when

相关标签:
1条回答
  • 2021-01-29 10:17

    The comments were right to question; lest anyone waste time on this you have to write the names of the parameters correctly, for example:

    create or replace function get(p_another in number) return number
       is ret number := 0;
       begin
          select sum(m.mot)
                  into ret
                  from rmtq mq
                  join rmo m on mq.id = m.id
                  where mq.another = p_another
           return(ret);
        end;
    
    0 讨论(0)
提交回复
热议问题