Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Procedure - not able to display no data found message

User_V1YTNMay 13 2020 — edited May 14 2020

Hi All,

I have created a procedure, which will take the Mgr number as input for execution.

When ever data is there for input passed Mgr number we are getting data. But when we don't have data it is not displaying "no data found" message.

create or replace procedure sp1 (mg number)

as

cursor c1 is select * from emp1 where mgr = mg;

i emp1%rowtype;

begin

for i in c1

loop

dbms_output.put_line(i.ename||' '||i.sal);

end loop;

exception

when no_data_found then

dbms_output.put_line('no data found');

end;

/

Can anyone please tell me how to display "no data found" message when there is no data for input Mgr number.

Thanks,

Subash

Comments
Post Details
Added on May 13 2020
11 comments
659 views