在存储过程中显示消息 [英] Show message in stored procedure

查看:91
本文介绍了在存储过程中显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示存储过程中的消息?

How do I show a message from a stored procedure?

什么是显示行是否存在的消息的正确语法?

What is the right syntax to display a message saying whether or not rows exist?

在SQL Server中,在WORKBENCH中显示消息蝙蝠是PRINT ...

In SQL Server it's PRINT to show a message bat in WORKBENCH...

CREATE PROCEDURE `new_proced` (
    in myid     int(3)
)
BEGIN
    if not exists (select id from table where id = myid)
then
    show message 'Row no exists';
else
    show message 'Row exists';
end if;
END

推荐答案

不完全确定为什么要执行类似的操作,但是可以执行以下操作: ...

Not entirely sure why you would want to do something like that, but you could do something like this: ...

then
  select 'YOUR MESSAGE HERE'  
else
  select 'YOUR OTHER MESSAGE HERE'
end if

或者您可以选择1或0,可能会更好一点...

Or you could select 1 or 0, might be a little better...

这篇关于在存储过程中显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆