9
我正在嘗試使用phpMyAdmin創建一個MySQL函數並獲取此錯誤。爲什麼mysql給出錯誤「不允許從函數返回結果集」?
#1415 - Not allowed to return a result set from a function
的功能代碼如下
DELIMITER $$
CREATE FUNCTION get_binary_count(a INT, c INT)
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE c1, c2 INT;
SET c1=0;
SET c2=0;
SELECT left_id AS c1 FROM mlm_user_mst WHERE parent_id=a AND left_id>0;
SELECT right_id AS c2 FROM mlm_user_mst WHERE parent_id=a AND right_id>0;
IF(c1>0 AND c2>0)
THEN
SET c=c+1;
SET c=c+get_binary_count(c1,0);
SET c=c+get_binary_count(c2,0);
END IF;
RETURN c;
END$$
DELIMITER ;
有什麼建議?
在此先感謝
在計算器已經解決,請訪問鏈接。 http://stackoverflow.com/questions/16177267/mysql-function-error-code-1415-not-allowed-to-return-a-result-set-from-a-func – nexttus 2016-06-07 05:47:23