如何检查引用游标是否从 pl/sql 过程返回数据
我想知道如何检查引用游标是否返回数据。
假设我在 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 是否发现某些东西的最佳方法是什么?
谢谢。
I would like to know how to check if a ref cursor returns data.
Let's say I have the following code in a PL/SQL package:
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;
This code is used in a more involved process and the query in Foo is using multiple tables.
I need the data returned from Foo in an asp.net application, but I also need to do something when Foo finds some data.
I want to reuse the query at a few places, but I don't think this would be a good candidate for a view.
What would be the best way to know if Foo finds something ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
知道它是否找到某些东西的唯一方法是从中获取:
The only way to know if it has found something is to FETCH from it: