· 9 years ago · Jan 24, 2017, 11:52 PM
1INSERT into Existing_Table SELECT col1,col2... from Other_table where rownum < 100000
2
3begin
4 INSERT into Existing_Table SELECT col1, col2... from Other_table where rownum < 100000;
5end;
6/
7
8create table Existing_Table
9(
10 existing_column number primary key
11);
12
13create table Existing_Table_2
14(
15 existing_column number
16);
17
18insert into Existing_Table (existing_column) values (1);
19
201 row inserted.
21
22begin
23 insert into Existing_Table (existing_column) values (1);
24end;
25
26Error starting at line : 1 in command -
27begin
28 insert into Existing_Table (existing_column) values (1);
29end;
30Error report -
31ORA-00001: unique constraint (APPS.SYS_C001730810) violated
32ORA-06512: at line 2
3300001. 00000 - "unique constraint (%s.%s) violated"
34*Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
35 For Trusted Oracle configured in DBMS MAC mode, you may see
36 this message if a duplicate entry exists at a different level.
37*Action: Either remove the unique restriction or do not insert the key.
38
39insert into Existing_Table_2 (existing_column) values (1);
40
411 row inserted.
42
43begin
44 insert into Existing_Table_2 (existing_column) values (1);
45end;
46
47PL/SQL procedure successfully completed.