Write a mysql8 function, the primary key of the parameter table, and return the result set of the query statement

CREATE FUNCTION getResultSet(KEY INT) RETURNS RESULTSET BEGIN DECLARE resultSet RESULT_SET; SELECT * FROM myTable WHERE id = KEY; SET resultSet = SELECT * FROM myTable WHERE id = KEY; RETURN resultSet; END;

Guess you like

Origin blog.csdn.net/weixin_35751412/article/details/129565658