C# batch inserts to Oracle

How do I execute multiple insert statements in a single call?  I've tried several variations and I just get a host of various errors indicating I don't know what I'm doing.

I've stripped down my command to the most basic, just tell me what I need for 2 and I can get that repeated.
INSERT INTO MyTable (MyColumn) VALUES (1)
INSERT INTO MyTable (MyColumn) VALUES (2)

I am pretty sure I am just missing a command separator or some command to indicate it is multiple statements (or both).
LVL 4
SkipFireAsked:
Who is Participating?
 
SriVaddadiConnect With a Mentor Commented:
Use ExecuteOracleNonQuery method and try
0
 
SriVaddadiCommented:
Semi colon (;)  is the batch separator in Oracle
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
SkipFireAuthor Commented:
How does that apply to ORACLE?
0
 
SriVaddadiCommented:
You are executing the query against the Oracle data provider right?

So your queries should adhere to oracle syntax
0
 
VenabiliCommented:
How does what apply to Oracle? The SqlDataAdapter? It's .NET, you do the inserts from .NET - that's where you are using it. And it is supported by the data Provider for Oracle (see the MSDN link)
0
 
SriVaddadiCommented:
SqlDataAdapter does not apply to Oracle it is Sql Server specific object. You have to use OracleDataAdapter if you want to System.Data.OracleClient.OracleDataAdapter
0
 
SkipFireAuthor Commented:
SriVaddadi - I am executing with an OracleCommand.ExecuteNonQuery(), and I know it needs to conform to the Oracle syntax, I'm just not sure what syntax I need to do a batch insert.  When I use a ; at the end of each insert statement I get an error stating "invalid character".  If I remove the ; I get command not properly ended.
0
 
SkipFireAuthor Commented:
Changed to execute individually.  Required to use dotConnect in production instead of the Oracle provider, so unable to test ExecuteOracleNonQuery.
0
 
VenabiliCommented:
SriVaddadi - that's what happens when I am thinking about one language and answering about another - I forget  that there were two classes here. :)
0
 
SriVaddadiCommented:
Venabili - I can understand. We would be in touch with the api methods which we mostly use. I guess you are more with SQL Server and I am a bit mix of both. :)
0
 
VenabiliCommented:
:) More a Java thing here really - we do not have separate implementations there - not for such things anyway. :) And yeah - had been doing some SQL server stuff in .NET lately and kinda forgot for a while that the SQL ones in .NET are for the SQL server, not for the SQL itself.

Seems like the asker is ok now so all is good.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.