Oracle SYS_GUID不变 [英] Oracle SYS_GUID does not change

查看:397
本文介绍了Oracle SYS_GUID不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Oracle项目,非常适合使用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;
/

来自 http://feuerthoughts.blogspot .com/2006/02/watch-out-for-sequential-oracle-guids.html

当我在数据库上运行它(在10g和11版上尝试过)时,我得到的输出是

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?

我不是很观察-GUID正在变化,但看起来我像上面的链接所谈论的顺序GUID问题一样.

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.

推荐答案

似乎还可以.从描述中:

Seems OK. From the description:

SYS_GUID生成并返回一个 全局唯一标识符(RAW值) 由16个字节组成.在大多数情况下 平台,生成的标识符 由主机标识符, 的进程或线程标识符 进程或线程调用 功能和 nonrepeating 值 (字节顺序)用于该过程 或线程.

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.

根据您的示例:


64FE4083D6BA7CB4E0400F0A0E0A18B0
64FE4083D6BB7CB4E0400F0A0E0A18B0
64FE4083D6BC7CB4E0400F0A0E0A18B0
64FE4083D6BD7CB4E0400F0A0E0A18B0
64FE4083D6BE7CB4E0400F0A0E0A18B0

没有人提及这些GUID值的分布.它们应该是非重复的,并且是.除非每次都得到完全相同的输出.

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.

这篇关于Oracle SYS_GUID不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆