Tuesday 25 December 2012

Insert Multiple records in DB

There are many scenarios where we have to check the performance in ADF while retrieving thousands of records from Database. For that we need this many records in our DB.

We can insert multiple records in one go by using PL/SQL block.

Begin
For <counter>in <start_counter>..<end_counter>
Loop
Insert into <table_name>(<column1>,<coulumn2>,<column3>)
values(
value1, value2,value3);
End loop;
End;


commit;

Example:

Begin
For i in 1..4000
Loop
Insert into Student (id,name,address)
values(i, dbms_random.string('A',5), dbms_random.string('B',5));
End loop;
End;

commit;


No comments:

Post a Comment