MySQL Forums
Forum List  »  Stored Procedures

Re: UUID column type
Posted by: Svend Høst
Date: October 28, 2005 03:58AM

Hi

I've created this function and it seems to be working fine.

CREATE FUNCTION `MyUUID`() RETURNS binary(16)
BEGIN
DECLARE my_uuid char(37);
SET my_uuid = UUID();
RETURN CONCAT(UNHEX(LEFT(my_uuid,8)),UNHEX(MID(my_uuid,10,4)),UNHEX(MID(my_uuid,15,4)),UNHEX(MID(my_uuid,20,4)),UNHEX(RIGHT(my_uuid,12)));
END

Can i assign the result of MyUUID as a default column value if none isn't supplied ?

thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
63547
October 16, 2005 10:15AM
28019
October 18, 2005 09:03AM
20958
October 18, 2005 07:47PM
27103
October 19, 2005 07:28AM
Re: UUID column type
17840
October 28, 2005 03:58AM
16541
September 08, 2007 03:46PM
15075
November 04, 2005 09:22AM


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.