Is there a way in MySQL to print debugging messages to stdout, temptable or logfile? Something like:
print in SQLServer
DBMS_OUTPUT.PUT_LINE in Oracle
解决方案
Option 1: Put this in your procedure to print 'comment' to stdout when it runs.
SELECT 'Comment';
Option 2: Put this in your procedure to print a variable with it to stdout:
declare myvar INT default 0;
SET myvar = 5;
SELECT concat('myvar is ', myvar);
This prints myvar is 5 to stdout when the procedure runs.
Option 3, Create a table with one text column called tmptable, and push messages to it:
declare myvar INT default 0;
SET myvar = 5;
insert into tmptable select concat('myvar is ', myvar);
You could put the above in a stored procedure, so all you would have to write is this: