MySQL Forums
Forum List  »  Stored Procedures

Re: How to call a stored procedure from a stored function with parameter?
Posted by: William Chiquito
Date: September 29, 2007 04:58PM

Hi Zsolt,

My test:
DELIMITER $$

DROP PROCEDURE IF EXISTS `IsProductInForeignDatabase`$$

CREATE PROCEDURE `IsProductInForeignDatabase`(IN stock INTEGER(11), OUT MyResult VARCHAR(1000), IN Behaviour VARCHAR(20))
BEGIN
	IF LOWER(Behaviour) = 'question' THEN
		SET MyResult = '123 My Result';
	END IF;
END$$

DELIMITER ;

DELIMITER $$

DROP FUNCTION IF EXISTS `myfunc`$$

CREATE FUNCTION `myfunc`()
	RETURNS VARCHAR(1000)
BEGIN
	DECLARE MyResult VARCHAR(1000);
	CALL IsProductInForeignDatabase(1, MyResult, 'question');
	RETURN MyResult;
END$$

DELIMITER ;

SELECT myfunc();
Result:
myfunc()     
-------------
123 My Result

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to call a stored procedure from a stored function with parameter?
12757
September 29, 2007 04:58PM


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.