首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >PL/SQL检查查询是否返回空

PL/SQL检查查询是否返回空
EN

Stack Overflow用户
提问于 2011-05-11 03:00:24
回答 4查看 96.2K关注 0票数 27

我正在编写一个过程,我需要检查我的select查询是否返回了空记录。(在此示例中是否没有x,y工具架)

我该怎么做呢?

我试过这个:

代码语言:javascript
复制
temp shelves.loadability%TYPE := NULL;
BEGIN

select loadability into temp from shelves where rownumber = x and columnnumber = y;
IF temp IS NOT NULL THEN
/* do something when it's not empty */
ELSE
/* do the other thing when it's empty */
END IF;

但是if的第二个分支永远不会起作用...

编辑:

哦,太简单了.

代码语言:javascript
复制
temp shelves.loadability%TYPE;
BEGIN

select count(*) into temp from shelves where rownumber = x and columnnumber = y;
IF temp != 0 THEN
/* do something when it's not empty */
ELSE
/* do the other thing when it's empty */
END IF;

END;
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5955025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档