/*---- 41b.sql -----*/ /* Example of a WHILE-loop in PL/SQL */ /* ** This block uses a simple WHILE loop to insert 10 rows into a table. ** The values of a counter variable, and either of two ** character strings are inserted. Which string is inserted ** depends on the value of the loop index. */ set echo on; drop table TEMP; create table TEMP (col1 number(9,4)); DECLARE x NUMBER := 100; BEGIN WHILE x < 1001 LOOP INSERT INTO TEMP VALUES (x); x := x + 100; END LOOP; COMMIT; END; / select * from TEMP;