1. 程式人生 > >oracle資料庫自定義函式get_uuid()

oracle資料庫自定義函式get_uuid()

1.oracle資料庫自定義函式get_uuid()

1 CREATE OR REPLACE FUNCTION GET_UUID
2     RETURN VARCHAR IS guid VARCHAR (50);
3 BEGIN
4      guid := lower(RAWTOHEX(sys_guid()));
5 RETURN
6     substr(guid,1,8)||'-'||substr(guid,9,4)||'-'||substr(guid,13,4)||'-'||substr(guid,17,4)||'-'||substr(guid,21,12);
7 END get_uuid;

2.查詢

 1 select get_uuid() from dual;