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
65162
October 16, 2005 10:15AM
28644
October 18, 2005 09:03AM
21503
October 18, 2005 07:47PM
27581
October 19, 2005 07:28AM
Re: UUID column type
18364
October 28, 2005 03:58AM
16947
September 08, 2007 03:46PM
15504
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.