MySQL Forums
Forum List  »  Stored Procedures

Wrong returnvalue on userdef function
Posted by: Franz Balleis
Date: June 26, 2019 01:39AM

Hi,
I have written several functions that give me different values from another database. All functions except one will return a value. The function shown below only provides OK back.

What am I doing wron



CREATE DEFINER=`mysql`@`%` FUNCTION `getNextSysNumber`( c_number_type varchar(64)) RETURNS int(18)
BEGIN
DECLARE nextnumber INTEGER DEFAULT 0;
SELECT
synewnumber.LastNumber
INTO nextnumber FROM
synewnumber
WHERE
UPPER(TRIM(synewnumber.TableName)) = UPPER(TRIM(c_number_type));
SET nextnumber = nextnumber + 1;
RETURN nextnumber;
END

Options: ReplyQuote




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.