I can not figure out how to put a huge amount of data in the table. The data must not repeat
Advise, may have other ways?
create table COUNTRIES (
COUNTRY_ID VARCHAR2(7),
COUNTRY_NAME VARCHAR2(40),
constraint COUNTRY_C_ID_PK primary key (COUNTRY_ID)
);
Begin
For IDS in 1..1000000
Loop
INSERT INTO "SYSTEM"."COUNTRIES" (COUNTRY_ID, COUNTRY_NAME) VALUES (dbms_random.string('L', 7), dbms_random.string('L', 15));
Commit;
End loop;
End;
The Oracle INSERT ALL statement is used to insert multiple rows with a single INSERT statement. You can insert the rows into one table or multiple tables by using only one SQL command.
You can add one row at a time to a table with the insert clause. This takes the form: insert into <table_name> ( col1, col2, ... ) values ( 'value1', 'value2', ... )
If you just want the amount of data and do not care about the randomness of the content,
insert into countries select rownum, 'Name'||rownum from dual
connect by rownum<=1000000;
should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With