how to insert multiple rows values(records or tuple) in oracle sql

How to insert multiple rows in oracle sql

We can insert multiple row values or tuple in a single run by using begin and end commands as shown below:

Syntax:

begin
insert into table_name values(column1_values,column2_values,....);
insert into table_name values(column1_values,column2_values,....);
insert into table_name values(column1_values,column2_values,....);
.....
commit;
end;
/


image
insertion of multiple rows in oracle sql







For example if we want to insert values in a table emp which has five columns defined we can insert
as shown below.

begin
insert into emp values(1000,'xxx',15000,'aaa',30);
insert into emp values(1001,'yyy',18000,'aaa',20);
insert into emp values(1002,'yyy',20000,'aaa',10);
commit;
end;
/


Explanation:The above query will insert three rows or tuple in emp table.
We can see using select command as--

select * from emp;

output:






I  hope you have understood  .However if you have any doubt comment below in comment section.

Comments

Popular posts from this blog

how to compile multiple file in java using single command

Error http://172.0.0.1:8080/apex application not found in oracle 10g Solved

Ternary operator and Nested Ternary operator