Show message in stored procedure

mysql, mysql-workbench, stored-procedures

Solution

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

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

Problem

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? 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 ```

Original source

Related problems