Can i Pass String Array to Procedure

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
jiayu821
Posts: 8
Joined: Thu 21 May 2009 05:22

Can i Pass String Array to Procedure

Post by jiayu821 » Wed 01 Feb 2012 08:27

i write a procedure which use a string array as parameter,
can i pass the string array as parameter to it using asp.net
in direct mode,

in oracle
i write
create or replace type T_Sale_Type as table of varchar2(2);

create or replace procedure P_Query(v_sale_type T_Sale_Type)

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Wed 01 Feb 2012 13:29

Yes, you can. For example you can use the following code in your asp.net project:

Code: Select all

            OracleConnection conn = new OracleConnection("host=***;port=1521;user id=***;password=***;sid=orcl1120;direct=true;");
            conn.Open();
            OracleCommand comm = new OracleCommand("P_Query", conn);
            comm.CommandType = System.Data.CommandType.StoredProcedure;
            OracleTable table = new OracleTable(OracleType.GetObjectType("T_Sale_Type",conn));
            table.Add("hi");
            table.Add("Ok");
            comm.Parameters.Add("table", OracleDbType.Table).Value = table;
            comm.ExecuteNonQuery();
            conn.Close();

jiayu821
Posts: 8
Joined: Thu 21 May 2009 05:22

The Code Can't Work Always

Post by jiayu821 » Thu 02 Feb 2012 10:19

First, thanks for you reply

but when i try you code in my program, i got the ora-03115 error on the line below:
OracleTable table = new OracleTable(OracleType.GetObjectType("T_Sale_Type", conn));

i used version 6.1 ,is the version's problem?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Thu 02 Feb 2012 14:56

Yes, the snippet of code will work only with the latest version of dotConnect for Oracle (6.70.293), because the support for OBJECT, TABLE, VARRAY, REF, XMLTYPE data types in Direct mode was added in this version. For more information please refer to http://www.devart.com/dotconnect/oracle ... story.html
You can upgrade to the latest version or refuse to use direct mode. You can also download the Trial Edition of dotConnect for Oracle at http://www.devart.com/dotconnect/oracle/download.html and evaluate new features.

Post Reply