I couldn't help noticing that stored procedures are able to return values:
create table foo(foo int);
insert into foo values (42);
create procedure get_foo() select * from foo;
call get_foo();
+------+
| foo |
+------+
| 42 |
+------+
More intriguing, wrapper such as python's MySQLdb do pass through the procedure's output to the caller.
However, no such behavior is documented. The documented way to get results out of the procedure is using OUT procedure arguments. I find this return value of stored procedure hardly used or indeed mentioned anywhere, yet it seems to be a useful behavior.
My question is, is this an artifact of stored procedures, or is it implemented on purpose but undocumented for some reason? How long has it been so, and can one rely on it?
(I tested on MariaDB 10.3 and don't know how this extends to MySQL as well).