//C#例public void Get_PrecedureData(){OracleConnection connection = null;//ConnectionOracleCommand oraCommand = new OracleCommand();OracleParameter paramId = null;OracleParameter paramTbl = null;OracleParameter paramCur = null;OracleRefCursor pInfoCur = null;DataSet dtRtn = new DataSet();//数据库连接connection = new OracleConnection("User Id=scott;Password=tiger;Data Source=oracle");connection.Open();oraCommand.Connection = connection;oraCommand.Parameters.Clear();// 存储过程 设定oraCommand.CommandText = "PKG_TEST.PROC_GET_DATA";oraCommand.CommandType = System.Data.CommandType.StoredProcedure;// 输入输出参数设定// Varchar2型paramId = oraCommand.Parameters.Add( "I_ID", OracleDbType.Varchar2, ParameterDirection.Input );// 数组类型参数设定paramTbl = oraCommand.Parameters.Add( "I_TBL", OracleDbType.Varchar2, ParameterDirection.Input );// 将CollectionType 设为 PLSQLAssociativeArrayparamTbl.CollectionType = OracleCollectionType.PLSQLAssociativeArray;//cursor 类型参数设定paramCur = oraCommand.Parameters.Add("O_CUR", OracleDbType.RefCursor, ParameterDirection.Output );//设置参数数组的大小//注意:参数的Value 属性和ArrayBindSize 属性必须为元素个数相同的数组,且个数等于参数的Size 属性int[] bindSize = new int[10];string[] tblData = new string[10];for(int ii = 0; ii < 10; ii++){tblData[ii] = ii.ToString();//数值bindSize[ii] = 10;//数值的大小}//数组参数设定paramTbl.Value = tblData;paramTbl.Size = 10;paramTbl.ArrayBindSize = bindSize;//存储过程执行oraCommand.ExecuteNonQuery();//out的cursor值的读取using(OracleDataAdapter da = new OracleDataAdapter()){if(paramCur.Value != System.DBNull.Value){pInfoCur = (OracleRefCursor)paramCur.Value;da.Fill(dtRtn, pInfoCur);}//取得记录数Console.WriteLine("the number of record count is {0}", dtRtn.Tables[0].Rows.Count);}oraCommand.Dispose();connection.Close();connection.Dispose();}