Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table..

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

Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table..

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

Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table..

Answer / dinesh a.

Using Forall bulk insertion

Is This Answer Correct ?    1 Yes 0 No

Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table..

Answer / selvaraj v

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

Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table..

Answer / raghavendra

insert into table 1 value (select * from table2 where
rownum<101 )

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Oracle General Interview Questions

What is Oracle table?

1 Answers  


What is the use of file param in imp command?

0 Answers  


what is meant by magic query

0 Answers  


If a table column has is UNIQUE and has NOT NULL, is it equivalent to a PRIMARY KEY column?

8 Answers   IBM,


Explain the use of consistent option in exp command.

0 Answers  


select * from emp what happened internally when we write this query in the sql prompt?

5 Answers  


Difference between primary key and unique key ?

77 Answers   Accenture, B2B Software Technologies, Cognizant, HP Finsoft, IndiaNIC, Karomi Technology, Keane India Ltd, L&T, Onward eServices, R Systems, Shakti, Techtic Solutions,


Q) How to Find Max Date from each Group? (Asked in Infosys (INFI)Interview)

4 Answers   Infosys,


How to get a list of all background sessions in the database?

0 Answers  


How to rename an index?

0 Answers  


When does a Transaction end ?

2 Answers  


What is a synonym? What are its various types?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)