Oracle Search

Monday, August 31, 2009

Question 16.Inserting more than 1 row/table with single query.

Can we insert more than 1 row with 1 qyery in same table/diff tables?

Yes, we insert more than 1 row with 1 qyery by using the following method?

syntax
INSERT ALL
INTO tablename1 (fieldlist) VALUES (valuelist)
INTO tablename2 (fieldlist) VALUES (valuelist)
INTO tablename3 (fieldlist) VALUES (valuelist)
SELECT * FROM DUAL;

Example:

insert all into student (sno, name) values (1, 'Raja')
into student (sno, name) values (2 'Ravi')
into student (sno, name) values (3, 'Balu')
select * from dual;

We can use more than 1 table also.
insert all into student (sno, name) values (1, 'Raja')
into student (sno, name) values (2 'Ravi')
into emp (eno, name) values (1, 'Mani')
select * from dual;

Interview quesitions and answers, objective type questions with answers : http://atchaya.com/ora/orahome.html
Oracle forum : http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle

0 comments:

atchaya.com