Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sys_guid() not always unique?

ChrisAug 7 2014 — edited Aug 7 2014

Hello,

I am al little puzzled by the following:

> create table test_table(id number(10), guid varchar2(32));

table TEST_TABLE created.

> insert into test_table(id,guid) values (1,null);

1 rows inserted.

> insert into test_table(id,guid) values (2,null);

1 rows inserted.

> insert into test_table(id,guid) values (3,null);

1 rows inserted.

> update test_table set guid=sys_guid();

3 rows updated.

> select * from test_table;

        ID GUID                          

---------- --------------------------------

         1 0006694068E012E1E05383153C0A9B5C

         2 0006694068E112E1E05383153C0A9B5C

         3 0006694068E212E1E05383153C0A9B5C

> drop table test_table;

table TEST_TABLE dropped.

So why do I get the same GUID in each row? Is Oracle lazy by only calling sys_guid() just once and then use it for all rows?

I want unique guid's. What is the best solution?

I am using Oracle XE 11g on a Windows machine.

This post has been answered by Dan Jankowski on Aug 7 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2014
Added on Aug 7 2014
7 comments
5,680 views