oracle 生成特定格式uuid

2021-08-27 20:43:47 字數 593 閱讀 4617

oracle中生成跨系統的唯一識別符uuid非常方便,比生成序列還簡單,直接用sys_guid()就行,

資料型別是 raw(16) 有32個字元。

它的生成機制足以保證全球所有系統產生的海量guid重複可能性非常小。這在aixm概念中非常重要。

如果要讓返回的uuid滿足標準格式,可利用如下函式實現:

create or replace

function get_uuid

return varchar

isguid varchar (50);

begin

guid := lower(rawtohex(sys_guid()));

return

substr(guid,1,8)||'-'||substr(guid,9,4)||'-'||substr(guid,13,4)||'-'||substr(guid,17,4)||'-'||substr(guid,21,12);

end get_uuid;

sql> select get_uuid from dual ;

get_uuid

a8f662b8-6e7a-13fe-e040-970a437c6bd7

以特定格式拆分日期

1.將給定字串解析成date格式 呼叫 dateformat類的parse 引數是string型別,返回值為date型別。如下 string str1 07月08日1900年 dateformat dateformat new dateformat mm月dd日yyyy年 date date dat...

js 獲取當前時間特定格式

1.獲取當前時間 var mydate new date 2.獲取時間中的年月日時分秒 mydate.getyear 獲取當前年份 2位 mydate.getfullyear 獲取完整的年份 4位,1970 mydate.getmonth 獲取當前月份 0 11,0代表1月 mydate.getda...

讀取採集的特定格式資料

target arm上實際採集的資料,byte輸出,讀取資料並輸出來 格式為意義 格式大小 ppdu id 1個int32 4bmac id 1個int32 4bmac addr 1個6位元組 hex 6bdata 1 dim陣列 256長度複數,先實部後虛部都是float16 256x4b imp...