Hi guys,
I've this issue with this code.
- declare
-
- ret_val int default 0;
- x int default 0;
- y int default 0;
- cumul int default 0;
-
- internal_counter int default 0;
-
- begin
-
- <<counter_loop>>
- for counter in 1..5 loop
-
- x := 10;
- y := 15;
-
- internal_counter := internal_counter + x;
-
- ret_val := x + y;
- cumul := ret_val + x;
-
- dbms_output.put_line('value ret_val X + Y :'
- || to_char(ret_val)
- || ' Value Cumul '
- || to_char(cumul)
- || ' Internal_Counter : '
- || to_char(internal_counter)
- );
-
- end loop counter_loop;
-
- end;
- /
In fact when I run thue code, I get the following results for each variable from the loop:
- value ret_val X + Y : 25 Value Cumul 35 Internal_Counter : 10
- value ret_val X + Y : 25 Value Cumul 35 Internal_Counter : 20
- value ret_val X + Y : 25 Value Cumul 35 Internal_Counter : 30
- value ret_val X + Y : 25 Value Cumul 35 Internal_Counter : 40
- value ret_val X + Y : 25 Value Cumul 35 Internal_Counter : 50
and
What I need, is increment the result returned from the first loop into the second variable and get the cumulative, (e.g.)
(value return X + Y :'25' Value cumul ' 35 ' Counter : ' 10)
(value return X + Y :'25' Value cumul ' 45 ' Counter : ' 20)
(value return X + Y :'25' Value cumul ' 55 ' Counter : ' 30)
(value return X + Y :'25' Value cumul ' 65 ' Counter : ' 40)
(value return X + Y :'25' Value cumul ' 75 ' Counter : ' 50)
Thank you in advance
Rgds
Message was edited by: Carl C
Code updated with variables names.