Use for counter in insert statement
SQL>
SQL> CREATE TABLE MyTable (
2 num_col NUMBER,
3 char_col VARCHAR2(60)
4 );
Table created.
SQL>
SQL>
SQL> BEGIN
2 FOR v_Count IN 1..10 LOOP
3 INSERT INTO MyTable (num_col, char_col)
4 VALUES (v_Count, 'Hello World!');
5 END LOOP;
6 END;
7 /
PL/SQL procedure successfully completed.
SQL>
SQL> SELECT * FROM MyTable;
NUM_COL CHAR_COL
-------- ------------------------------------------------------------
1.00 Hello World!
2.00 Hello World!
3.00 Hello World!
4.00 Hello World!
5.00 Hello World!
6.00 Hello World!
7.00 Hello World!
8.00 Hello World!
9.00 Hello World!
10.00 Hello World!
10 rows selected.
SQL>
SQL>
SQL> drop table MyTable;
Table dropped.
SQL>
Related examples in the same category