Thursday, March 4, 2010

Online GUID Generator's

Oracle's GUID

SYS_GUID generates and returns a globally unique identifier (RAW value) made up of 16 bytes. On most platforms, the generated identifier consists of a host identifier, a process or thread identifier of the process or thread invoking the function, and a nonrepeating value (sequence of bytes) for that process or thread.


The following example adds a column to the sample table hr.locations, inserts unique identifiers into each row, and returns the 32-character hexadecimal representation of the 16-byte RAW value of the global unique identifier:

Example 1:

ALTER TABLE locations ADD (uid_col RAW(16));

UPDATE locations SET uid_col = SYS_GUID();

SELECT location_id, uid_col FROM locations
ORDER BY location_id, uid_col;

----------- ----------------------------------------------------------------
1000 09F686761827CF8AE040578CB20B7491
1100 09F686761828CF8AE040578CB20B7491
1200 09F686761829CF8AE040578CB20B7491
1300 09F68676182ACF8AE040578CB20B7491
1400 09F68676182BCF8AE040578CB20B7491
1500 09F68676182CCF8AE040578CB20B7491

Example 2:

create table test (ID raw(16) default sys_guid(), name varchar2(10));

insert into test(name) values ('DAS');

insert into test(name) values ('DDAS');

select * from test;

-------------------------------- ----------
CF874CB4F32A47C19859DA2BB0D71AB4 DAS
2B768E600A484391B6B8D5C4924D2785 DDAS

No comments: