.NET 程序中用事物处理多个存储过程
执行command.ExecuteNonQuery();时报错 代码和错误提示 如下:
ORA-06550: 第 1 行, 第 23 列:
PLS-00222: 在此范围中不存在名为 'NEW_ORDER' 的函数
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
//上面是存储过程参数赋值 省略...
IDataParameter[] paraList = new IDataParameter[19];
List<IDataParameter[]> parasList = new List<IDataParameter[]>();
IDataParameter[] paraList2 = new IDataParameter[4];
List<IDataParameter[]> parasList2 = new List<IDataParameter[]>();
sqlList.Add("NEW_ORDER");
sqlList.Add("NEW_ORDER_ITEM");
paraList[0] = p; paraList[1] = p1; paraList[2] = p2; paraList[3] = p3;
paraList[4] = p4; paraList[1] = p1; paraList[5] = p5; paraList[6] = p6;
paraList[7] = p7; paraList[8] = p8; paraList[9] = p9; paraList[10] = p10;
paraList[11] = p11; paraList[12] = p12; paraList[13] = p13; paraList[14] = p14;
paraList[15] = p15; paraList[16] = p16; paraList[17] = p17; paraList[18] = p18;
paraList2[0] = p19; paraList2[1] = p20; paraList2[2] = p21; paraList2[3] = p22;
parasList.Add(paraList);
parasList.Add(paraList2);
d.ExecuteSqlTran(sqlList.ToArray(), parasList,myConnection);
/// <summary>
/// 执行多条SQL语句,实现数据库事务。
/// </summary>
/// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的OracleParameter[])</param>
public void ExecuteSqlTran(string[] SQLStringList, List<IDataParameter[]> sql,OracleConnection oraCon)
{
using (OracleConnection conn = oraCon)
{
conn.Open();
using (OracleTransaction trans = conn.BeginTransaction())
{
try
{
for (int i = 0; i < SQLStringList.Length; i++)
{
OracleCommand command = BuildIntCommand(conn, SQLStringList[i], sql[i]);
command.Transaction = trans;
command.ExecuteNonQuery();
}
trans.Commit();
}
catch(Exception ex)
{
trans.Rollback();
LogerUtils.WriteLog("错误提示:" + ex.Message);
throw;
}
}
}
}
ORACLE .NET oracle存储过程
补充:.NET技术 , C#