请帮我解决Mysql功能。代码:
DELIMITER $$
CREATE FUNCTION `media`.`Return_Next_Season`(
season VARCHAR(200) )
RETURNS VARCHAR
DECLARE _ids INT ;
DECLARE _bsk VARCHAR(200);
SELECT id INTO _ids FROM media._broadcast_seasons WHERE broadcast_season_key = '20132014_Fall';
SELECT broadcast_season_key INTO bsk FROM media._broadcast_seasons WHERE id = ids;
RETURN bsk;
BEGIN
END$$
DELIMITER ;
答案 0 :(得分:0)
你认为在所有执行某些有用的代码之后 您会注意到我也改变了返回类型,因为我认为这也是必要的。BEGIN
是一个好主意吗? :-)或者,用较为迟钝的语言,将BEGIN
移到RETURNS VARCHAR
之后,类似(select
语句为了可读性而分解,但您可能需要重新组合它们):< / p>
DELIMITER $$
CREATE FUNCTION `media`.`Return_Next_Season`(
season VARCHAR(200) )
RETURNS VARCHAR(200)
BEGIN
DECLARE _ids INT ;
DECLARE _bsk VARCHAR(200);
SELECT id INTO _ids FROM media._broadcast_seasons
WHERE broadcast_season_key = '20132014_Fall';
SELECT broadcast_season_key INTO bsk FROM media._broadcast_seasons
WHERE id = ids;
RETURN bsk;
END$$
DELIMITER ;