如何在 asp.net 中使用过程(包)中的多个光标输出值

Posted

技术标签:

【中文标题】如何在 asp.net 中使用过程(包)中的多个光标输出值【英文标题】:How to use Multiple Cursor Output values from procedure(package) in asp.net 【发布时间】:2012-04-28 17:05:35 【问题描述】:
Procedure GetDetails( ID as Varchar2,
                       Cursor1 OUT Cursor_Type,
                        Cursor1 OUT Cursor_Type ) AS

BEGIN

       OPEN CURSOR1 FOR 
              Select Name from User where UserID=ID;

       OPEN CURSOR2 FOR 
               Select Place from Dept where DeptID=ID;

END GetDetails;

如何使用来自 2 个光标的名称和位置值?

【问题讨论】:

使用引用 Using a ref cursor as input type with ODP.NET 【参考方案1】:

尝试使用DataReader.NextResult 移动到下一个光标。例如:

while (dr.Read())

  //first cursor goes here

if (dr.NextResult() == true)

  while (dr.Read())
  
    //Second cursor goes here
  

【讨论】:

以上是关于如何在 asp.net 中使用过程(包)中的多个光标输出值的主要内容,如果未能解决你的问题,请参考以下文章