2021-12-22
oracle 存储过程游标查询为空, 怎么写让其结束存储过程 而不执行后面的dml逻辑?
oracle 存储过程游标查询为空, 怎么写让其结束存储过程 而不执行后面的dml逻辑?
我来答
添加附件
收藏
分享
问题补充
3条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
oracle 存储过程游标查询为空, 怎么写让其结束存储过程 而不执行后面的dml逻辑?
描述不完整,建议上代码看看
评论
有用 0基本的东西,建议先找本Oracle PL/SQL的书来看看吧
评论
有用 0declare
cursor ca is select code from tb_city_basic where province='AMS';
xx tb_city_basic.code%type;
begin
open ca;
fetch ca into xx;
if ca%found then
dbms_output.put_line('cursor');
dbms_output.put_line('not empty');
end if;
end;
/
PL/SQL procedure successfully completed.
declare
cursor ca is select code from tb_city_basic where province='新疆';
xx tb_city_basic.code%type;
begin
open ca;
fetch ca into xx;
if ca%found then
dbms_output.put_line('cursor');
dbms_output.put_line('not empty');
end if;
end;
/
cursor
not empty
第一种是CURSOR为空的情况,第二种是非空的
评论
有用 0
墨值悬赏