使用 C# Oracle 批量插入?

发布于 2024-11-16 07:42:15 字数 602 浏览 6 评论 0 原文

我正在尝试在 Oracle DB 中插入值。我有一个存储过程,现在一次插入一行。但在这里阅读有关批量插入的更多信息(http://stackoverflow.com/questions/343299/bulk-insert-to-oracle-using-net,http://dotnetslackers.com/articles/ado_net/BulkOperationsUsingOracleDataProviderForNETODPNET.aspx),似乎最好将参数值作为数组传递。我有一个类似这样的通用列表,即employeeList。

class employee()
{ 
  public int ID {get; set;} 
   public string Name {get; set;}
}

我如何调用我的存储过程(我知道我需要使用其中的参数进行更改,以获取参数数组)并将每个参数值作为数组传递以进行批量插入(尝试遵循示例链接)?

I am trying to insert values in Oracle DB. I have a stored procedure which right now insert one row at a time. But reading more about bulk insert here (http://stackoverflow.com/questions/343299/bulk-insert-to-oracle-using-net, http://dotnetslackers.com/articles/ado_net/BulkOperationsUsingOracleDataProviderForNETODPNET.aspx), it seems like it is better to pass parameter value as an array. I have a generic list something like this i.e. employeeList.

class employee()
{ 
  public int ID {get; set;} 
   public string Name {get; set;}
}

How can i call my stored procedure (i know i need to make change with my in parameter in it, to take array of parameter) and pass each parameter value as an array to do bulk insert (trying to follow the example link)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蝶…霜飞 2024-11-23 07:42:15

即使您传入一个数组,您仍然一次只能执行一个 DML。
如果您希望批量加载以提高速度,请写出一个文件并使用 SQL Loader 批量插入到您的表中。
这是获得数千行超快速性能的唯一方法。

Even if you pass in an array you still can only do one DML at a time.
If you are wanting bulk loading for speed, write out a file and use SQL Loader bulk insert into your table.
It is the only way to get super fast performance for thousands of rows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文