【问题标题】:ADO .NET OUT Variables Oracle 10G vs 11GADO .NET OUT 变量 Oracle 10G 与 11G
【发布时间】:2015-12-02 06:21:59
【问题描述】:

问题: 过程中的 OUT 变量未返回。

背景: 我最近将一个应用程序从 Oracle 10g 更新到了 Oracle 11G。我们使用的是 12c 版本的 Oracle 客户端。

应用程序在 .NET 3.5 上运行。

Database db = CreateDatabase(connectionName);
            var dbCmd = db.GetStoredProcCommand(procedureName);

            ConvertParams(ref dbCmd, parameters);

            try
            {
                iReturn = db.ExecuteNonQuery(dbCmd, _transaction);
                if (transaction == null) //if a transaction hasn't been passed, it isn't intended to has control over commit/rollback out of method, so app can do it
                    _transaction.Commit();
            }
            catch (Exception ex)
            {
                if (transaction == null)
                    _transaction.Rollback();
                throw ex;
            }
            finally
            {
                DebugSpCommand(procedureName, parameters);
                GetOutputParams(ref parameters, dbCmd);
                if (transaction == null)
                {
                    if (_transaction.Connection != null)
                        _transaction.Connection.Close();
                    _transaction.Dispose();
                }
            }
        }
        catch (OracleException ex)
        {
            Framework.ErrorHandling.ErrorHandler.HandleException(ex, "DATA_LAYER_POLICY");
            Framework.Logging.Logger.Write(ex.Message, LogCategories.Debug);
            iReturn = ex.Code;
        }
        catch (Exception ex)
        {
            Framework.ErrorHandling.ErrorHandler.HandleException(ex, "DATA_LAYER_POLICY");
            Framework.Logging.Logger.Write(ex.Message, LogCategories.Debug);
        }

【问题讨论】:

    标签: c# .net oracle oracle11g ado.net


    【解决方案1】:

    您可以在存储过程中使用 out 变量

    【讨论】:

    • 问题是我在 PL/SQL 过程中的输出变量返回了一个数字,而我的 C# 代码需要一个字符。出于某种原因,它正在使用 Oracle 10G。
    猜你喜欢
    • 2018-05-22
    • 1970-01-01
    • 2011-08-13
    • 1970-01-01
    • 2012-07-29
    • 2014-01-11
    • 2012-01-22
    • 2011-12-15
    • 2012-10-30
    相关资源
    最近更新 更多