![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
18.04 How to use cursor loop
CURSOR LOOP
loop
fetch <<,,,,,>> into <<,,,,>>;
exit when <<,,,>>%NOTFOUND;
end loop; For example :
In one table ( named as testl ) has got two columns as rain-date and rain-fall,
We need to cumulate the rain-fall till the last record available, We are going to use one datatype as cursor along with looping concepts, Declare
cum-railfall number; cursor Cl select * from testl; Cl-val Cl%ROWTYPE;
-- Cl the name assinged to cursor
-- * symbol is used for selecting all the columns available in the testl table,
-- Cl-val is another variable takes the value of cursor Cl Record as
Rowtype
Begin
open cl;
-----
opening the cursor
loop
----
repetitive action starts