【发布时间】:2010-10-28 15:26:50
【问题描述】:
我想知道如何检查引用游标是否返回数据。
假设我在 PL/SQL 包中有以下代码:
type refcursor is ref cursor;
procedure Foo(cursorresult out refcursor) is
begin
open cursorresult for
select *
from table t
inner join t2 on t.id = t2.id
where t.column1 is null;
end;
procedure DoSomeghingIfFooHasResults is
curFoo refcursor;
begin
Foo(curSansOwner);
if curFoo%found then
-- Do something
end if;
end function;
此代码用于更复杂的过程,Foo 中的查询使用多个表。
我需要在一个asp.net应用程序中从Foo返回的数据,但是当Foo找到一些数据时我也需要做一些事情。
我想在几个地方重用查询,但我认为这不是一个很好的视图候选者。
知道 Foo 是否找到了什么最好的方法是什么?
谢谢。
【问题讨论】:
标签: oracle plsql cursor ref-cursor