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;