Search code examples
c#.netoracle-databasedata-interchange

Associative Arrays vs UDT Tables for .NET/Oracle Data Interchange


I have a requirement to pass bulk data between a .NET (c#) application and an Oracle Database. So far, two alternatives have presented themselves, namely Associative Arrays and Tables of User Defined Data Types (UDTs)

So far, I have set up an example for UDT tables, which works quite nicely. It performs substantially better than making an insert call for each item row of bulk data, and am tempted to leave it at that, however I would be reticent not to consider Associate Arrays.

A colleague has told me that Associative Arrays are a language construct only recognised within PL/SQL code on Oracle, and not by pure SQL. Given that our Oracle developers are encouraged to write set-based SQL wherever possible, it seemed the natural choice to opt for UDT tables.

However, I would be interested to know more of the relative advantages/disadvantages between these two methods of interchanging bulk data so I can make a more informed (and justifiable) decision going forward.

Your help would be most appreciated.

Many Thanks


Solution

  • From the Oracle side, based on this question on AskTom:

    The major difference between:

    (index by tables)[=associative arrays] and (nested tables/varrays)

    is that index by tables are only available in PLSQL, nested tables/varrays are avaialable in both PLSQL and SQL.

    Index by tables are a bit more flexible and you could expect a small increase in performance but it is unlikely to be a huge improvement. If you're just using the array as a container to pass data to Oracle the difference may be too negligible to be measurable.

    If you plan to use the functions from SQL you'll have to use nested tables.