473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multiple rows insertion in single insert query.

sumittyagi
202 Expert 100+
Hi All,
Is it possible in oracle to insert multiple rows in a single insert query, as is possible in sql server:
insert into test_table values ('abc', 'xyz'), ('mno', 'pqr');

This syntax is not supported in oracle. Is oracle having any alternative for this one.

Thanks & happy new year in advance.
Dec 27 '07 #1
10 18381
debasisdas
8,127 Expert 4TB
try to use bulk insert using PL / SQL
Dec 28 '07 #2
sumittyagi
202 Expert 100+
try to use bulk insert using PL / SQL
Hi debashisdas,
Thanks for your reply. I know that can be done by PL/SQL, but in that case there will be multiple insert queries. I was wondering if there is any alternative in oracle for Multiple rows insertion specifically with single insert query.

Thanks.
Dec 28 '07 #3
The syntax you are asking about is not supported in Oracle.
Dec 28 '07 #4
sumittyagi
202 Expert 100+
The kind of syntax you are asking in SQL Server is not suppoerted in Oracle.
Thanks for your replies.
Jan 7 '08 #5
Hi All,
Is it possible in oracle to insert multiple rows in a single insert query, as is possible in sql server:
insert into test_table values ('abc', 'xyz'), ('mno', 'pqr');

This syntax is not supported in oracle. Is oracle having any alternative for this one.

Thanks & happy new year in advance.
Multiple rows can be inserted using only one insert statement only when you have got the data available in some other table in the database. In that case you can use following query:

Expand|Select|Wrap|Line Numbers
  1. insert into table1
  2. select * from table2
assuming that the structures of table1 and table2 are the same.
Jan 8 '08 #6
debasisdas
8,127 Expert 4TB
Multiple rows can be inserted using only one insert statement only when you have got the data available in some other table in the database. In that case you can use following query:

Expand|Select|Wrap|Line Numbers
  1. insert into table1
  2. select * from table2
assuming that the structures of table1 and table2 are the same.
yes that is one option ,but the user was not certainly asking about that.
Jan 8 '08 #7
Use triggers for insert or write PL/SQL for multiple insertition.
Jan 9 '08 #8
hi dear
if u want to insert the multiple values with single insert statement
then try this
insert into tablename values('&column1',&column2,.......);

actually column1 is in quotes because it is varchar or char
for number use the simple like column2
for date field u have to use like column1

on execution of statement it will ask to enter the values untill u will enter.

i hope it will help u.
Jul 9 '08 #9
Pramma
2
Yes. It is possible in Oracle.
Follow the query like

insert all
into table1 values(.,.,),
into table2 values(.,.,),
into table3 values(.,.,),
...
..
select * from dual;
Jul 16 '08 #10
Pramma
2
If u want to insert into same table multiple row, keep the tablename same in the above query. thats it.
Jul 16 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eric Kincl | last post by:
Hello, I have an array of data in PHP. I would like to insert each member of the array into it's own row in SQL. The array is of variable length, so it would have to be dynamic code. How would...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
3
by: gregory.sharrow | last post by:
I need to secure a datawarehouse table at the row level based on 1 to many keys on that table. A user should only see the rows they have access to. I need to be able to figure out which rows they...
5
by: Robert Brown | last post by:
Hi All. I have a routine that checks a SQL Table for all records 3 months prior to a predetermined date, then I insert them into an Archive DB then delete those records from the original table....
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
2
by: Diego | last post by:
Hi everybody! I'm using DB2 PE v8.2.3 for linux. I've defined a database with the following schema: ANNOTATION(ID,AUTHOR,TEXT) ANNOTATION_BOOK(ANNOTATION_ID,OBJECT_ID)...
2
by: hellboss | last post by:
Hi Every one ! I need to insert a set of values which are passed thru the parameter ,Below is the code to do the Single table insertion , Now I need to do multiple table insertion ie, to insert...
2
by: newbie | last post by:
Dear folks, pardon me if this is a stupid question. For this table --------------------------------------- | id | foo | bar | -------------------------------------- I...
24
by: Henry J. | last post by:
My app needs to insert thousand value rows into a mostly empty table (data are read from a file). I can either use inserts, or use merge. The advantage of using merge is that in the few cases...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.