1. 程式人生 > >JAVA ,JavaScript,SQL生成UUID

JAVA ,JavaScript,SQL生成UUID

Java:

import java.util.UUID;

String F_GUID = UUID.randomUUID().toString();

SQL:

select sys_guid() from dual;

JavaScript:

var F_GUID= NewGuid();
function NewGuid() {   
   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());   
}

function S4() {   
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);   
}