c#怎么执行sql脚本在oracle中创建包和包体
展开全部
调用方式如下:
using (var conn = new OracleConnection(oradb))
using (var cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "PKG_NAME.INSERT_FUNC";
cmd.BindByName = true;
cmd.Parameters.Add("Return_Value", OracleDbType.Int16,
ParameterDirection.ReturnValue);
cmd.Parameters.Add("i_description", OracleDbType.Varchar2, 1000,
promotionEventSetupDetails.PromotionDescription,
ParameterDirection.Input);
cmd.Parameters.Add("i_theme", OracleDbType.Varchar2, 80,
promotionEventSetupDetails.PromotionTheme,
ParameterDirection.Input);
cmd.Parameters.Add("o_id", OracleDbType.Varchar2,
ParameterDirection.Output);
cmd.Parameters.Add("o_error_msg", OracleDbType.Varchar2,
ParameterDirection.Output);
conn.Open();
using (var dr = cmd.ExecuteReader())
{
// 业务代码
}
}
using (var conn = new OracleConnection(oradb))
using (var cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "PKG_NAME.INSERT_FUNC";
cmd.BindByName = true;
cmd.Parameters.Add("Return_Value", OracleDbType.Int16,
ParameterDirection.ReturnValue);
cmd.Parameters.Add("i_description", OracleDbType.Varchar2, 1000,
promotionEventSetupDetails.PromotionDescription,
ParameterDirection.Input);
cmd.Parameters.Add("i_theme", OracleDbType.Varchar2, 80,
promotionEventSetupDetails.PromotionTheme,
ParameterDirection.Input);
cmd.Parameters.Add("o_id", OracleDbType.Varchar2,
ParameterDirection.Output);
cmd.Parameters.Add("o_error_msg", OracleDbType.Varchar2,
ParameterDirection.Output);
conn.Open();
using (var dr = cmd.ExecuteReader())
{
// 业务代码
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |