oracle获得uuid,java生成uuid
1.oracle获得uuid
Java代码
SQL>selectsys_guid()fromdual;
SYS_GUID()
--------------------------------
F18031C69D8345DEB305D4B2E796A282
SQL>selectsys_guid()fromdual;
SYS_GUID()
--------------------------------
F18031C69D8345DEB305D4B2E796A282
2.java生成uuid
Java代码
importjava.util.UUID;
publicclassIdGenerate{
publicstaticStringgetUUIDString(){
Stringid=UUID.randomUUID().toString();
id=id.replace("-","");
returnid;
}
publicstaticvoidmain(String[]args){
System.out.println(IdGenerate.getUUIDString());
}
}
importjava.util.UUID;
publicclassIdGenerate{
publicstaticStringgetUUIDString(){
Stringid=UUID.randomUUID().toString();
id=id.replace("-","");
returnid;
}
publicstaticvoidmain(String[]args){
System.out.println(IdGenerate.getUUIDString());
}
}分享到: