首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SingleStore异常no_data_found

SingleStore异常no_data_found
EN

Database Administration用户
提问于 2022-06-23 20:54:39
回答 1查看 96关注 0票数 1

我很难在单存储区中找到异常no_data_found

在<>Oracle中,我们使用no_data_found异常。对于no_data_found异常,单存储区中是否有其他解决方案?

EN

回答 1

Database Administration用户

回答已采纳

发布于 2022-07-05 20:51:59

如果它在存储过程中,则可以使用ER_INTO_VARIABLES_NO_ROWS。例子如下:

代码语言:javascript
复制
create table test(id int primary key, descr varchar(10));
insert into test values (1,'one'),(2,'two'),(3,'three');

delimiter $
create or replace procedure test_sp(inp_id int)
returns void as
declare
      v_descr varchar(10);
begin
       begin
         select descr into v_descr from test where id = inp_id;      
         echo select v_descr;
         exception
           when ER_INTO_VARIABLES_NO_ROWS then 
                echo select 'No rows found';
        end;
end $
delimiter ;

call test_sp(1); -- returns 'one'
call test_sp(100); -- returns 'No rows found'
票数 1
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/313712

复制
相关文章

相似问题

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