MySQL Forums
Forum List  »  Stored Procedures

Simple Stored Function not working
Posted by: John Noble
Date: January 01, 2022 06:19AM

Hi folks,

I have a simple function that when I call it it returns no output. It just says "OK" in the message on workbench.

Here is the function. It accepts a varchar(4) parameter and returns a varchar(4).

CREATE FUNCTION `fn_GetVatAccountID`(businessGroup varchar(4)) RETURNS varchar(4)
BEGIN

DECLARE vVatAccountID varchar(4) default "";

SELECT salesVat INTO vVatAccountID FROM vat WHERE businessGroup = businessGroup LIMIT 1;


RETURN vVatAccountID;
END

I am calling in using :
SELECT fn_getVatAccountID("FRFR")

When I run the SQL manually it returns the expected result. Its just when I call it from the function I get nothing back.

Any ideas ?

J

Options: ReplyQuote


Subject
Views
Written By
Posted
Simple Stored Function not working
298
January 01, 2022 06:19AM
173
January 01, 2022 06:55AM


Sorry, only registered users may post in this forum.

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.