Hi this is the code:let me know any issues reg this
declare
2 i pls_integer :=1;
3 begin
4 loop
5 dbms_output.put _line(i);
6 i :=i+1;
7 exit when i=&n;
8 end loop;
9 end;
10 /
Enter value for n: 7
old 7: exit when i=&n;
new 7: exit when i=7;
1
2
3
4
5
6
This is with FOR loop
SQL> begin
2 for i in 1..&n
3 loop
4 dbms_output.put _line(i);
5 end loop;
6 end ;
7 /
Enter value for n: 2
old 2: for i in 1..&n
new 2: for i in 1..2
1
2
Comment