oracle - Pl/SQL Looping through the values of a cursor -
function Total inc (varchar2 in name 2) returns varchar2 total total number (6); Select monthly_inquas from Cursor C1 employee where name = name_in; BEGIN total_value: = 0; C1 LOOP total_value for employee_reck: = total_val + employee_re_mammle_income; End loop; Return all_val; End; In this example, I am being told that we are looping through values, but I do not believe that we are getting through the values why Employee_rec.monthly_income required? Also, when I do employee_reck on FETCH , I think they are different from each other. I think they are different from each other.
You are looping through the result set in the record . In other words: Open the cursor C1 for employee_rec
in c1 and Perform a fetch on it For each row, assign the Record to a record variable named employee_rec . Then in the context of monthly_income , you have to say employee_rec.monthly_income on your code and not just monthly_income to say < / P> When I do a FETCH on employee_reck
employee_reck is not a cursor (its one variable) so that you do not get it from it. In this case, get from C1 is implied by the loop, so there is no clear fact required on your part.
Comments
Post a Comment