传递参数但无法获取?

passing parameter but unable to fetch?

如何解决这个问题,无法获取? 我正在传递 IN 参数,但仍然无法获取。

 create or replace procedure p1(p_ename in varchar2,p_sal out number)is
 begin
  select salary into p_sal from employees where last_name=p_ename;
 dbms_output.put_line(p_sal);
 end;

 variable b number;
 execute p1('King',:b);


[info](https://infoallsite.wordpress.com/2016/01/29/unable-to-fetch- data)


 [error][1]

 ' got error ,but only one row has last_name as King, '
  how to resolve I  want  to get the salary of king.
  [1]: http://i.stack.imgur.com/AsOHG.png'

您 table 的名称 King 可能超过 1 行。

运行这个

select count(*) from employees where last_name='King';

如果 returns 多于 1 行,那么您必须选择需要哪一行 select。如果您想要随机的任何行,请在您的程序中使用此 select。

select salary into p_sal from employees 
where last_name=p_ename 
and rownum<2;