我想創建與下面的查詢功能,但是發生錯誤創建MySQL功能
DELIMITER $$
CREATE FUNCTION getOnlineUserTraffic (x1 VARCHAR(32))
RETURNS FLOAT
DETERMINISTIC
BEGIN
DECLARE dist FLOAT;
SET dist = SELECT UsedCreditTraffic FROM uonlineuser WHERE UserName=x1
RETURN dist;
END$$
DELIMITER ;
//的userName =與長度焦炭= 32
// UsedCreditTraffic =浮
絕對不要告訴我們您收到的錯誤信息;) – Wrikken 2014-11-24 19:31:46
錯誤代碼:1064 您的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,選擇正確的語法,以便在'用戶名= x1 '從uonlineuser中選擇UsedCreditTraffic RETURN dist; END'在第6行 – user3780058 2014-11-24 19:35:30
'SELECT UsedCreditTraffic INTO dist FROM uonlineuser WHERE UserName = x1' – Wrikken 2014-11-24 19:37:49