Home | Add to Favorites | Ebooks Directory | News  
SQL & PL/SQL  Resources
Home
SQL , PL/SQL  Article
SQL Tutorial 
Books
SQL  Questions
SQL Code
PL/SQL Tutorial
SQL Reference
PL/SQL Tutorial
 

Using cursor  in Pl/SQL Sample code


 

declare
2 cursor hari is
3 select region_id from regions;
4 ram regions.region_id%type;
5 begin
6 open hari;
7 loop
8 fetch hari into ram;
9 dbms_output.put_line(to_char(ram));
10 exit when hari%notfound;
11 end loop
12 ;
13 close hari;
14 commit;
15 end;
16 /


 

Using  SQL%notfoud   in Pl/SQL Sample code

declare
2 cursor hari is
3 select region_id,region_name from regions;
4 type ram is record(ram1 regions.region_id%type,ram2 regions.region_name%type);
5 ram5 ram;
6 begin
7 open hari;
8 loop
9 fetch hari into ram5;
10 exit when hari%notfound;
11 dbms_output.put_line(to_char(ram5.ram1));
12 end loop;
13 close hari;
14 end;
15 /

The following code explains about SQL%notfound

                                                          Go To Index