WHILE Loop: This condition will evaluate to NULL, since v_Counter is initialized to NULL by default
SQL>
SQL> CREATE TABLE MyTable (
2 num_col NUMBER,
3 char_col VARCHAR2(60)
4 );
Table created.
SQL>
SQL>
SQL> DECLARE
2 v_Counter BINARY_INTEGER;
3 BEGIN
4 WHILE v_Counter <= 50 LOOP
5 INSERT INTO MyTable
6 VALUES (v_Counter, 'Loop index');
7 v_Counter := v_Counter + 1;
8 END LOOP;
9 END;
10 /
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> select * from MyTable;
no rows selected
SQL>
SQL> drop table MyTable;
Table dropped.
Related examples in the same category