ORACLE存储过程调用

OracleParameter[] para = new OracleParameter[] {
new OracleParameter("startMonth",OracleDbType.Varchar2,"2019-01-01", ParameterDirection.Input),
new OracleParameter( "ENDMONTH",OracleDbType.Varchar2,"2019-04-01",ParameterDirection.Input ),
new OracleParameter( "P_CUR",OracleDbType.RefCursor ,ParameterDirection.Output)
};

 

public static DataTable GetDataByProcedure(string proName, OracleParameter[] paras)
{
using (OracleConnection conn = new OracleConnection(strConn))
{
OracleCommand cmd = new OracleCommand(proName, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(paras);
OracleDataAdapter oda = new OracleDataAdapter(cmd);
conn.Open();
DataSet ds = new DataSet();
oda.Fill(ds);
conn.Close();
return ds.Tables[0];
}
}

 

posted @ 2019-05-05 15:18  名字已被使用N次  阅读(648)  评论(0编辑  收藏  举报