MySQL自定义函数 发表于 2016-11-21 1234567DROP FUNCTION IF EXISTS F_TESTCREATE FUNCTION F_TEST(PID INT) RETURNS VARCHARBEGIN DECLARE NAME_FOUND VARCHAR DEFAULT ""; SELECT EMPLOYEE_NAME INTO NAME_FOUND FROM TABLE_NAME WHERE ID = PID; RETURN NAME_FOUND;END;