Search code examples
c#oraclestored-proceduresoracle10goledb

Is it possible to send a Int[] to an Oracle Stored Procedure using OleDb


Is it possible to send an int[] from a c# application using OleDb to an Oracle Stored Procedure?

I was wondering if there is a specific way of setting up both c# OleDbType and the type in the Oracle stored procedure. At the moment I am using this kind of setup.

C#

int[] intArray = new int[] { 1, 2};

cmd.Parameters.Add(new OleDbParameter("var_name", intArray));
cmd.Parameters[i].OleDbType = OleDbType.Variant
cmd.Parameters[i].Size = 20;

Oracle

TYPE intArray IS TABLE OF NUMBER;
PROCEDURE proc(var_name IN intArray);

Thankyou in advance - Ankou


Solution

  • Managed to fix my own problem.

    Seeing as no one has came up with a solution I decided to fix this problem by sending in a string of CSV, then created a split method in order to add each value to TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER; which could then be used elsewhere.

    So have a solution and a String Split function too :)