MySQL Forums
Forum List  »  Stored Procedures

user-define function cant work
Posted by: Kung Kok Keong
Date: March 15, 2005 03:55AM

anyone can help me to debug my function or not. my function can't return the value when i passed the correct value on it.

CREATE FUNCTION GetCountry (PhoneNumber VARCHAR(20)) RETURNS VARCHAR(100)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE bFound INT DEFAULT 0;
DECLARE a VARCHAR(255);
DECLARE cur1 CURSOR FOR SELECT Country FROM test.Rates_MY WHERE Code = PhoneNumber;

OPEN cur1;
REPEAT
FETCH cur1 INTO a;
SET bFound = 1;
UNTIL bFound > 0 END REPEAT;
CLOSE cur1;

RETURN a;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
user-define function cant work
4533
March 15, 2005 03:55AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.