praveen1981
asked on
Bulk update from dotnet to oracle
Hi
I have 2000 rows in a csv file with three columns , i want to update these in to oracle database table based on certain condition , i can do this by using looping which is not optimised, can you please suggest me for optimised code or query to update this.
I have 2000 rows in a csv file with three columns , i want to update these in to oracle database table based on certain condition , i can do this by using looping which is not optimised, can you please suggest me for optimised code or query to update this.
>>then send the whole record as single to insert
You cannot chain commands like this in Oracle.
I believe you will need array binding:
http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59odpnet-085168.html
You cannot chain commands like this in Oracle.
I believe you will need array binding:
http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59odpnet-085168.html
ASKER
Construct the Adhoc querry using Stringbuilder and insert the record as single short with Transaction scope
StringBuilder sb = new StringBuilder();
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
then send the whole record as single to insert
can you please elobarate these, how can we send this whole to the stored Procedure from dotnet
StringBuilder sb = new StringBuilder();
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
then send the whole record as single to insert
can you please elobarate these, how can we send this whole to the stored Procedure from dotnet
To send the input to Storeprocedure construct the string with the SP details as follows
StringBuilder sb = new StringBuilder();
sb.Append("exec <<OracleStoreProcedure>>(' " + Val1+"','" + val2 + "','"+ val3 +"')\n");
sb.Append("exec <<OracleStoreProcedure>>(' " + Val1+"','" + val2 + "','"+ val3 +"')\n");
sb.Append("exec <<OracleStoreProcedure>>(' " + Val1+"','" + val2 + "','"+ val3 +"')\n");
StringBuilder sb = new StringBuilder();
sb.Append("exec <<OracleStoreProcedure>>('
sb.Append("exec <<OracleStoreProcedure>>('
sb.Append("exec <<OracleStoreProcedure>>('
@santhimurthyd
Again,
You cannot chain commands together like this in Oracle and pass the string to a single 'execute' method.
If you are going to keep suggesting this as a viable approach please post a simple working test showing it.
Again,
You cannot chain commands together like this in Oracle and pass the string to a single 'execute' method.
If you are going to keep suggesting this as a viable approach please post a simple working test showing it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
This solution is fine, but i have used the xml file as input to the stored procedure to update the bulk data.
Thanks for your solution.
This solution is fine, but i have used the xml file as input to the stored procedure to update the bulk data.
Thanks for your solution.
StringBuilder sb = new StringBuilder();
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
sb.Append("insert into TableName values('" + Val1+"','" + val2 + "','"+ val3 +"')");
then send the whole record as single to insert