oracle - passing parameter but unable to fetch? -


how resolve one, unable fetch ? passing in parameter still unable fetch.

 create or replace procedure p1(p_ename in varchar2,p_sal out number)is  begin   select salary p_sal employees 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 1 row has last_name king, '   how resolve  want  salary of king.   [1]: http://i.stack.imgur.com/asohg.png' 

you table has more 1 rows name king.

run this

select count(*) employees last_name='king'; 

if returns more 1 row, have choose row need select. if want row @ random, use select in procedure.

select salary p_sal employees  last_name=p_ename  , rownum<2; 

Comments