Ho to insert no. of records at a time..i mean i want to
insert 100 records at a time into a table
Answer Posted / ron
i assume you are doing batch processing (say processing of
millions of rows):
1. add a new column to the table say t2 called
processed_rows char(1) not null default of 'N'
2. in a pl/sql block (start loop);
update processed columns to 'P' for processing
where rownum<101;
2. if rowcount after update=0 exit loop.
3. next insert into t1 select from t2 where processed_rows='P'
4. update t2 change column from 'P' to 'Y (saying processed)
6 commit;
7. loop until all rows are processed.
8. advantages. you can restart the process after failure.
and done have to start all over again only those that that
have not been processed will be processed.
to improve performance is millions of rows are being
processed then:
partition the table table;
and run the above sql against each individual partitions;
processing will be done that many times faster.
good luck!
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Compare and contrast between sql and sql server and explain its various functions?
What is the difference between translate and replace in oracle?
When do you get a .pll extension in oracle?
How are extents allocated to a segment?
Can we use oracle pl/sql block in core java? if so how? pls get back to me .....
List the types of joins used in writing subqueries?
What are the ansi data types supported in oracle?
How to define a data source name (dsn) in odbc manager?
What is the purpose of tables, private synonyms and public synonyms in Oracle?
Describe varray?
What is a view and how is it different from a table?
What is the difference between primary key and unique key and foreign key in oracle?
Describe an oracle table?
What are joins, explain all types of joins?
What is a trace file and how is it created in oracle?