PL/SQL Using In&In Reverse Options in the Loop


begin
  for v_counter in 0..10 loop
      if mod(v_counter,2)=0 then
            dbms_output.put_line('v_counter='||v_counter);
          end if;
    end loop;
    dbms_output.put_line('Done...');
end;

begin
  for v_counter in reverse 0..10 loop
      if mod(v_counter,2)=1 then
            dbms_output.put_line('v_counter='||v_counter);
          end if;
    end loop;
    dbms_output.put_line('Done..');
end;


*******outputs********
v_counter=0
v_counter=2
v_counter=4
v_counter=6
v_counter=8
v_counter=10
Done...

v_counter=9
v_counter=7
v_counter=5
v_counter=3
v_counter=1
Done..

Comments

Popular posts from this blog

Solution for "Can not obtain Oracle client information from registry"

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"