Creating a function to remove - from uuid

tonelm54
tonelm54 used Ask the Experts™
on
Good evening,
Ive been playing around with a function, which removes the - from the uuid() statment.

delimiter //
CREATE FUNCTION uuid2()
RETURNS STRING
DETERMINISTIC
BEGIN
DECLARE strUUID STRING;
SET strUUID = REPLACE(uuid(),"-","");
return strUUID;
END//
delimiter ;

Open in new window


And then call it like
select uuid2();

However everytime I try the above code I get an error similar to:-
ERROR: Unknown Punctuation String @ 11
STR: //
SQL: delimiter //

Any suggestions on what Ive messed up with would be appriciated!

Thank you


Select uuid2();
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
DELIMITER //
CREATE FUNCTION uuid2()
RETURNS varchar(32)
DETERMINISTIC
BEGIN
DECLARE strUUID varchar(32);
SET strUUID = REPLACE(uuid(),"-","");
return strUUID;
END//
delimiter ;

There is no "string" type ... use varchar(32) (or however long you want it to be).

Ss

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial