#DICA - Oracle Identificador Único Universal (UUID)

É possível através da função SIS_GUID é possível gerarmos um identificador global exclusivo. Este identificar é composto por 16 bytes, gerando um valor que não se repetirá independente da plataforma utilizada. 
SQL> conn lamim
Enter password:
Connected.

SQL> select SYS_GUID() from dual;

SYS_GUID()
--------------------------------
60DEBF92CC4B72C1E0531301070ADF9E

SQL> select SYS_GUID() from dual;

SYS_GUID()
--------------------------------
60DEBF92CC4C72C1E0531301070ADF9E

SQL> select SYS_GUID() from dual;

SYS_GUID()
--------------------------------
60DEBF92CC4D72C1E0531301070ADF9E


SQL> create table uuid_teste (uid_col RAW(32), data date);

Table created.

SQL> insert into uuid_teste values (SYS_GUID(),sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL> insert into uuid_teste values (SYS_GUID(),sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL>
SQL> insert into uuid_teste values (SYS_GUID(),sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL>  select uid_col, to_char(data,'dd/mm/yyyy hh24:mi:ss') from uuid_teste;

UID_COL                                                          TO_CHAR(DATA,'DD/MM
---------------------------------------------------------------- -------------------
60DEBF92CC4A72C1E0531301070ADF9E                                 21/12/2017 16:20:01
60DEBF92CC4E72C1E0531301070ADF9E                                 21/12/2017 16:26:34
60DEBF92CC4F72C1E0531301070ADF9E                                 21/12/2017 16:27:04
Fonte:https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions175.htm#SQLRF06120
SHARE

Jhonata Lamim

  • Image
  • Image
  • Image
  • Image
  • Image