Ho to insert no. of records at a time..i mean i want to
insert 100 records at a time into a table
Answers were Sorted based on User's Feedback
Answer / swapna
Example there is a table name emp.It has 100 records
Another table name is dept
Now i want to insert table emp 100 records into dept
--insert into dept select * from emp
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
In oracle 10g :
---------------->
Step 1 : SQL> CREATE TABLE identity( ID NUMBER);
Step2 : Write a Simple Procedure for to insert values into
table.
DECLARE
i NUMBER;
BEGIN
FOR i IN 1..100 LOOP
INSERT INTO identity VALUES(i);
END LOOP;
END;
/
PL/SQL procedure successfully completed.
Step 3 : SELECT COUNT(*) FROM identity;
COUNT(*)
----------
100
Please check it. Works fine.
PL/SQL procedure successfully completed.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / raghavendra
insert into table 1 value (select * from table2 where
rownum<101 )
Is This Answer Correct ? | 2 Yes | 4 No |
What are the advantages of oracle 12c?
which language is used to develop the oracle........?
How to set up autotrace for a user account?
Does rowid change in oracle?
What is recovery manager in Oracle?
Can we create database in oracle using command line ?
Why do we need integrity constraints in a database?
what is the syntax of ALTER command?
I have created one package with out procedures in package specification and in package body i have used 2 procedures. is it compile????
Explain the importance of .pll extension in oracle?
A VIEWS takes memory in the database. If yes, how can u proove it? is there any way to display the size of views?
Table1- have two column filename data AFGDFD-20112011 hi how r u bsdasd-23042011 name shoud be in bold Now i want output like filename data AFGDFD hi how r u bsdasd name shoud be in bold Kindly answer this