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
1552
June 26, 2019 01:39AM
364
June 26, 2019 11:19AM
Re: Wrong returnvalue on userdef function
362
June 29, 2019 01:11AM
341
June 29, 2019 12:21PM
386
June 30, 2019 04:17AM
337
June 30, 2019 11:24AM
344
July 01, 2019 12:39AM
357
July 01, 2019 09:43AM
356
July 03, 2019 03:28AM
350
July 03, 2019 11:15AM
368
July 08, 2019 02:00AM
331
July 08, 2019 09:29AM
331
July 09, 2019 07:44AM
311
July 09, 2019 01:52PM
331
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.