Upper Bound in FOR loop does not get altered in loop,Why?
Posted
by Vineet
on Stack Overflow
See other posts from Stack Overflow
or by Vineet
Published on 2010-04-12T18:38:17Z
Indexed on
2010/04/12
18:43 UTC
Read the original article
Hit count: 295
Hi ALL, I am trying to change the value of upper bound in For loop ,but the Loop is running till the upper bound which was defined in the starting.
According to logic loop should go infinite, since value of v_num is always one ahead of i,But loop is executing three time.Please explain
This is the code
DECLARE
v_num number:=3;
BEGIN
FOR i IN 1..v_num LOOP
v_num:=v_num+1;
DBMS_OUTPUT.PUT_LINE(i ||' '||v_num);
END LOOP;
END;
Ouput Coming
1 4
2 5
3 6
© Stack Overflow or respective owner