0
我的SQL代碼是這樣的:MySQL存儲功能語法錯誤INNER JOIN表
DELIMITER $$
CREATE FUNCTION `get_theme`(`section_type` VARCHAR(50))
RETURNS VARCHAR(50)
CONTAINS SQL
SQL SECURITY DEFINER
BEGIN
DECLARE name,dirname VARCHAR(50) ;
SELECT a.name INTO name , a.dirname INTO dirname FROM themes as a
INNER JOIN sections as b ON
a.section_id = b.id
WHERE b.name = 'administrators' AND a.`status` = 'Y';
RETURN name + '#' + dirname;
END $$
DELIMITER ;
當我執行在heidiSQL 9.2.0.4961這個代碼,我得到這個錯誤:沒有定義的變量:一個
但當我執行此代碼:
SELECT a.name as name , a.dirname as dirname FROM themes as a
INNER JOIN sections as b ON
a.section_id = b.id
WHERE b.name = 'administrators' AND a.`status` = 'Y';
有沒有問題,它工作得很好。
我的代碼有什麼問題?任何想法 ?