In previous versions of Oracle
we are using like this
SQL>set serveroutput on
SQL>
begin
for i in 1 .. 5 loop
dbms_output.put_line(i);
end loop;
end;
/
1
2
3
4
5
or for reversing of numbers we are using like this
SQL>begin
for i in reverse 1 .. 7 loop
dbms_output.put_line(i);
end loop;
end;
/
7
6
5
4
3
2
1
PL/SQL procedure successfully complete
In 21c we can combine both like this
sql>begin
for i in 1 .. 5, reverse 7 .. 1 loop
dbms_output.put_line(i);
end loop;
end;
/
1
2
3
4
5
7
6
5
4
3
2
1
PL/SQL procedure successfully completed.