0

I'm porting my old project. It previously use Oracle.DataAccess.Client library to access with oracle database.

Now, I want to use Npgsql library to access with Postgresql database. So I need to porting the old c# code which use Oracle library method. For example, the old code use OracleCommand.ArrayBindCount property to insert multi rows at once.

But I do not see the similar method or property to do the same thing.

I want to know if there're similar ways to achieve it.

Xie Steven
  • 8,256
  • 1
  • 6
  • 21

1 Answers1

0

No, there's nothing like ArrayBindCount in Npgsql/PostgreSQL.

However, you can batch two (or more) INSERT statements in the same CommandText (delimited by semicolons) and have all the parameters for all statements on that command. This would execute efficiently as a single batch. For really efficient bulk insert, use COPY which is by far the fastest.

You also can refer below post.

Does PostgreSQL have the equivalent of an Oracle ArrayBind?

Jason
  • 9,555
  • 1
  • 8
  • 18