Tuesday, February 9, 2016

Get a custom GUID in Oracle

       

drop function get_custom_guid;

create function get_custom_guid
   return varchar2 is

     l_guid varchar2(36);

begin

   select substr(guid,0,8) || '-' || substr(guid, 9,4) || '-' || substr(guid, 13,4)|| '-' || substr(guid, 17,4) || '-' || substr(guid,21)<

    into l_guid from (select sys_guid() as guid from dual) ;

   return l_guid;

end;



select get_custom_guid() guid from dual;

       
 

No comments:

Post a Comment