Check if the cursor contains something or not?

MyPlanet 2002-09-28 02:36:08
I want to check a cursor contains something or not in a procedure, before return it. If nothing inside the cursor, I would like do something else (for example, load other data record to the cursor). I don't want to pass back a empty cursor (please see the code as following part).

What is the best way to check the io_curArchiveData cursor contains something or not ?


------------------------------------------------------- code
PROCEDURE Get_Archive_Data(
in_numArchiveID IN NUMBER,
io_curArchiveData IN OUT udt_ref_cur )
IS

BEGIN

-- Get record
OPEN io_curArchiveData FOR
SELECT ASM.archive_nm,
ASM.date_created,
ASM.created_by_id
FROM IQUASR.ASUBMISSION ASM
WHERE ASM.archive_id = in_numArchiveID;

-- Check io_curArchiveData contains something or not ???

-- If nothing in io_curArchiveData, do something.
......
...全文
66 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
MyPlanet 2002-09-28
  • 打赏
  • 举报
回复
Those 属性 don't work.

After "OPEN io_curArchiveData FOR" ..., the io_curArchiveData%found and io_curArchiveData%notfound are always NULL, and io_curArchiveData%rowcount is always 0 (It doesn't matter if the io_curArchiveData contains something or not).
jiezhi 2002-09-28
  • 打赏
  • 举报
回复
游标有found和notfound的属性
还有rowcount属性

17,379

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧