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
64961
October 16, 2005 10:15AM
28568
October 18, 2005 09:03AM
21432
October 18, 2005 07:47PM
27503
October 19, 2005 07:28AM
Re: UUID column type
18301
October 28, 2005 03:58AM
16881
September 08, 2007 03:46PM
15460
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.