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)

DECLARE vVatAccountID varchar(4) default "";

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

RETURN vVatAccountID;

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 ?


Options: ReplyQuote

Written By
Simple Stored Function not working
January 01, 2022 06:19AM
January 01, 2022 06:55AM

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.