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!

how to continue loop when no data found

User_5T7BPMay 21 2019 — edited May 21 2019

Hi All.

I want to continue the loop and increment loop counter even if there is no data in select statement how can I do that ?

FOR Lcntr IN 1..68

LOOP

begin

  

   select ENAME into NAME from EMPLOYEE where EMPID=Lcntr  ;

   dbms_output.put_line(ENAME );

  end;

END LOOP;

there is no data for EMPID=15 but it should not throw no data error , instead counter should move to 16 and print details of EMPID 16,How can I do this ?

Comments
Post Details
Added on May 21 2019
3 comments
12,358 views