aboutsummaryrefslogtreecommitdiff
path: root/res/sql/functions/orcl_gen_uuid.sql
blob: 466fe65b387e58d7ad8748b77ccdd41c6b4fdd82 (plain)
1
2
3
4
5
6
7
8
9
10
11
CREATE OR REPLACE FUNCTION gen_uuid
  RETURN VARCHAR
AS
  BEGIN

    RETURN regexp_replace(rawtohex(sys_guid())
    , '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
    , '\1-\2-\3-\4-\5');

  END;
/