生成 GUID

Create Or Replace Function Generateguid
Return Char Is
    V_Guid Char(40);
Begin
    Select Substr(Sys_Guid(),1,8)||'-'||Substr(Sys_Guid(),9,4)||'-'
                        ||Substr(Sys_Guid(),13,4)||'-'||Substr(Sys_Guid(),17,4)||'-'
                        ||Substr(Sys_Guid(),21) Into V_Guid 
                        From Dual;
    Return V_Guid;
Exception
    When Others Then
    dbms_output.put_line('Error '|| SQLERRM);
End Generateguid;