SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL>
SQL> -- Create a table for the example.
SQL> CREATE TABLE myTable
2 (id NUMBER NOT NULL
3 ,CONSTRAINT id_pk PRIMARY KEY (id));
Table created.
SQL>
SQL>
SQL>
SQL> DECLARE
2 TYPE number_table IS TABLE OF myTable.id%TYPE;
3
4 number_list NUMBER_TABLE := number_table();
5
6 BEGIN
7
8
9 number_list.EXTEND(10000);
10
11
12 FOR i IN 1..10000 LOOP
13
14
15 number_list(i) := i;
16
17 END LOOP;
18
19
20 FORALL i IN 1..number_list.COUNT
21 INSERT INTO myTable VALUES (number_list(i));
22 END;
23 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table myTable;
Table dropped.
|