Re: Wrong returnvalue on userdef function
Hi Peter,
yes this OK is very strange, and I can not tell where this damn OK is coming from. The table has this deffinition and is filled with the current index key of the ERP system.
_____________________________________________________________________________
CREATE TABLE `synewidvalues` (
`GroupName` varchar(64) COLLATE latin1_german1_ci NOT NULL,
`LastNumber` int(18) DEFAULT NULL,
PRIMARY KEY (`GroupName`),
UNIQUE KEY `synewidvalues1` (`GroupName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
______________________________________________________________________________
When I start a query via SQL I get the following result
SELECT synewnumber.LastNumber FROM synewnumber
WHERE UPPER(TRIM(synewnumber.TableName)) = UPPER(TRIM('sg_sys_objektdaten'));
RESULT:
742
OUTPUT:
09:00:11 SELECT synewnumber.LastNumber FROM synewnumber WHERE UPPER(TRIM(synewnumber.TableName)) = UPPER(TRIM('sg_sys_objektdaten')) LIMIT 0, 1000 1 row(s) returned 0.000 sec / 0.000 sec
exactly what I'm expecting..
_____________________________________________________________________________
Here is the Code of this function
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
_____________________________________________________________________________
Now the same Query via function.
select mand22.getNextSysNumber('sg_sys_objektdaten');
RESULT: no result, but
OUTPUT:
09:04:48 select mand22.getNextSysNumber('sg_sys_objektdaten') LIMIT 0, 1000 OK 0.063 sec
i go crazy
Thank you for your support
Franz
PS: all this operations are done with the MYSL Workbench 8.0
Subject
Views
Written By
Posted
1634
June 26, 2019 01:39AM
404
June 26, 2019 11:19AM
Re: Wrong returnvalue on userdef function
407
June 29, 2019 01:11AM
387
June 29, 2019 12:21PM
439
June 30, 2019 04:17AM
381
June 30, 2019 11:24AM
382
July 01, 2019 12:39AM
395
July 01, 2019 09:43AM
396
July 03, 2019 03:28AM
396
July 03, 2019 11:15AM
426
July 08, 2019 02:00AM
371
July 08, 2019 09:29AM
370
July 09, 2019 07:44AM
351
July 09, 2019 01:52PM
382
July 10, 2019 01:03AM
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.