MySQL Forums
Forum List  »  Stored Procedures

Re: Declare variable inside a function
Posted by: William Chiquito
Date: June 14, 2007 05:07AM

Hi Jon,

Try:
DELIMITER $$

DROP FUNCTION IF EXISTS `fn_GetYearAlbumRank`$$

CREATE FUNCTION `fn_GetYearAlbumRank`(parmAlbumID INT, parmYear INT)
	RETURNS INT
BEGIN
	DECLARE retval INT;
	SELECT 5 INTO retval;
	RETURN retval;
END$$

DELIMITER ;

SELECT fn_GetYearAlbumRank(1,2);
Result:
fn_GetYearAlbumRank(1,2)
------------------------
                       5

Options: ReplyQuote


Subject
Views
Written By
Posted
57786
June 14, 2007 02:06AM
Re: Declare variable inside a function
15835
June 14, 2007 05:07AM
6658
December 28, 2008 11:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.