Select clausule inside pl/sql function return wrong value
问题 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 I put this code inside a function: create or replace function get(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 = another return(ret); end; and I call: exec dbms_output.put_line(get(138)); return value = 39, which is incorrect. What is that 39? 回答1: The