473,725 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple rows insertion in single insert query.

sumittyagi
202 Recognized Expert New Member
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 18408
debasisdas
8,127 Recognized Expert Expert
try to use bulk insert using PL / SQL
Dec 28 '07 #2
sumittyagi
202 Recognized Expert New Member
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
chritzuk
10 New Member
The syntax you are asking about is not supported in Oracle.
Dec 28 '07 #4
sumittyagi
202 Recognized Expert New Member
The kind of syntax you are asking in SQL Server is not suppoerted in Oracle.
Thanks for your replies.
Jan 7 '08 #5
vikas000000a
46 New Member
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 Recognized Expert Expert
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
vijay dev
1 New Member
Use triggers for insert or write PL/SQL for multiple insertition.
Jan 9 '08 #8
bondwiththebest
1 New Member
hi dear
if u want to insert the multiple values with single insert statement
then try this
insert into tablename values('&column 1',&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 New Member
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

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

Similar topics

2
3192
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 I go about this? Would I stick the SQL querry generation and actual querry into a while loop? This would generate a lot of traffic between the SQL server and the PHP script. The arrays are each over 1000 members long, however, this is an rare...
8
5519
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, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press Release section record would look like this: Username: John Doe Function Name: Press Release
3
2548
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 have access to using a single sql statement and it cannot be dynamic SQL or a stored procedure (this is a limitation based on the reporting tool we use). The conditions can be any combination of "and" and "or" operators. I have seen posts (and...
5
3778
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. When I do a "select" for the records, I load them into a dataset, use an "insert" statement to insert the info into the second table (by a for next loop and using executenonquery , then a "delete" statement to remove them.
7
3389
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 either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
2
2935
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) BOOK(ID,AUTHOR,TITLE). Between the book and annotation entities there is a many-to-many
2
2583
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 values with the addtional parameter in another table but using the same stored procedure !! CREATE procedure . @SID int, @FirstName varchar(10), @MiddleName varchar(10), @LastName varchar(10), @FullName varchar(10),
2
2668
by: newbie | last post by:
Dear folks, pardon me if this is a stupid question. For this table --------------------------------------- | id | foo | bar | -------------------------------------- I understand that we can insert a row to the table per call, like this sql_query = "INSERT INTO `table` (`foo`, `bar`) VALUES ('$string_1',
24
7142
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 where the table is not empty, it can take care of the updating part, which makes the app cleaner. However, my concern is the merge state would slow dowm the insertion of new data, since in most cases the table is empty. So my questions (before I...
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.