简体   繁体   English

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

[英]ADO .NET OUT Variables Oracle 10G vs 11G

Issue: OUT variables from the procedures are not being returned. 问题:未返回过程中的OUT变量。

Background: I recently updated an application from Oracle 10g to Oracle 11G. 背景:我最近将一个应用程序从Oracle 10g更新到Oracle 11G。 WE are using an 12c version of Oracle client. 我们正在使用12c版本的Oracle客户端。

The application runs on .NET 3.5. 该应用程序在.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变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM