I'm creating alternate of uuid_short() function named custom_uuid_short.
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `custom_short_uuid`() RETURNS bigint(20) unsigned
BEGIN
declare shorty bigint(20) unsigned;
set shorty = 100;
SET @incremented_variable:=@incremented_variable+1;
SELECT (((525190530 & 255) << 56) + (Uptime << 24) + @incremented_variable) into shorty
FROM
(SELECT variable_value Uptime
FROM information_schema.global_status
WHERE variable_name = 'Uptime_since_flush_status') up;
RETURN @incremented_variable;
END
The problem is @incemented_variable will be null when i create this function on new database.
Is there any way to do initialize the variable if not initialized in the funtion itself?
Aucun commentaire:
Enregistrer un commentaire