Oracle SYS_GUID 不变
我有一个 Oracle 项目,非常适合使用 GUID 作为密钥。 找到了以下代码片段
SET SERVEROUTPUT ON
BEGIN
FOR indx IN 1 .. 5
LOOP
DBMS_OUTPUT.put_line ( SYS_GUID );
END LOOP;
END;
/
我从 http://feuerthoughts .blogspot.com/2006/02/watch-out-for-sequential-oracle-guids.html
当我针对我的数据库运行它时(我在版本 10g 和版本 11 上尝试过),我得到的输出如下
64FE4083D6BA7CB4E0400F0A0E0A18B0
64FE4083D6BB7CB4E0400F0A0E0A18B0
64FE4083D6BC7CB4E0400F0A0E0A18B0
64FE4083D6BD7CB4E0400F0A0E0A18B0
64FE4083D6BE7CB4E0400F0A0E0A18B0
: 价值永远不会改变! 我需要做些什么才能将其设置为按预期工作吗?
编辑:我不是很善于观察 - GUID 正在变化,但看起来我遇到了上面链接所讨论的顺序 GUID 问题。
I have an Oracle project that would be a good fit for using GUIDs as a key. I found the following snippet
SET SERVEROUTPUT ON
BEGIN
FOR indx IN 1 .. 5
LOOP
DBMS_OUTPUT.put_line ( SYS_GUID );
END LOOP;
END;
/
From http://feuerthoughts.blogspot.com/2006/02/watch-out-for-sequential-oracle-guids.html
When I run it against my database (I tried it on versions 10g and version 11) I get output like
64FE4083D6BA7CB4E0400F0A0E0A18B0
64FE4083D6BB7CB4E0400F0A0E0A18B0
64FE4083D6BC7CB4E0400F0A0E0A18B0
64FE4083D6BD7CB4E0400F0A0E0A18B0
64FE4083D6BE7CB4E0400F0A0E0A18B0
I.e. the value never changes! Is there something I have to do to set this up to work as expected?
Edit: I am not very observant - the GUIDs are changing, but it looks like I am suffering from the sequential GUID problem that the link above is talking about.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来还可以。 从描述来看:
从您的示例来看:
没有人提到有关这些 GUID 值的分布的任何内容。 它们应该是不重复的,而且确实如此。 除非你每次都得到完全相同的输出。
Seems OK. From the description:
From your example:
Nobody mentioned anything about the distribution of these GUID values. They should be nonrepeating and they are. Unless you get exactly the same output every time.
值确实改变了......
The value does change....