Friday, June 7, 2013

11th Example - FOR REVERSE on PL/SQL

Leave a Comment
FOR looping operator in PL/SQL block has a variation that is capable of processing inverted. If the previous operator FOR looping with dilated ascending numbers results (1 to 10), this time will be shown examples of operators capable FOR looping with results ordered descending number (10 to 1).

DECLARE
  jumlah NUMBER:=10;
BEGIN
  FOR i IN REVERSE 1..jumlah LOOP
      DBMS_OUTPUT.PUT_LINE(i);
  END LOOP;
END;
/

Above PL/SQL block has an additional operator commands FOR REVERSE in part. REVERSE command will automatically reverse looping process without having to change the looping logic itself.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment