ADO .NET OUT 变量 Oracle 10G 与 11G

ADO .NET OUT Variables Oracle 10G vs 11G

问题: 过程中的 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);
        }

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