我测试的结果,不相同的:
SQL> alter table xxx add(c2 raw(32) default sys_guid() not null);Table alteredSQL> desc xxx
Name Type        Nullable Default    Comments 
---- ----------- -------- ---------- -------- 
C1   VARCHAR2(2) Y                            
C2   RAW(32)              sys_guid()          SQL> 
SQL> insert into xxx(c1) values('1')
  2  /1 row insertedSQL> /1 row insertedSQL> /1 row insertedSQL> /1 row insertedSQL> /1 row insertedSQL> /1 row insertedSQL> select * from xxx;C1 C2
-- ----------------------------------------------------------------
1  C51FA19659FC4A7AB81B2B6521CD5068
1  4AFB010E6B8E4AE6AD752AB077899698
1  9C591666A19A4F2CA6F89A552194BCB0
1  3248F0E5C26E4EF0A9C19C689B4F5424
1  95AF426F23C04F8FB1448D3EFF3655C4
1  93F71B7C205649DFAC24E6FA0576CFF8
1  2A6930FB545E4596900665C0C9F2A63D
1  0DFA2E78781344F6A2D8DBD40F8D1C54
1  5A4E5C944D434285BA3454759F62BF2E
1  7435DC800B214C4E8F7427C31C820996
1  96A58F60D44C47FB9930BFB9ACE7BDDB11 rows selectedSQL> 

解决方案 »

  1.   

    我又测试了一次。我在linux shell登陆到命令行的sqlplus的。彻底郁闷死!为什么啊。oracle跟我过不去。
    我的系统是10g+rhel3
    [oracle@lacl-001 oracle]$ sqlplusSQL*Plus: Release 10.1.0.2.0 - Production on Mon Sep 20 18:42:45 2004Copyright (c) 1982, 2004, Oracle.  All rights reserved.Enter user-name: lacl
    Enter password:
    ERROR:
    ORA-01017: invalid username/password; logon denied
    Enter user-name: lacl
    Enter password:Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining optionsSQL> CREATE TABLE LACL.testsygguid
      2  (
      3      ANNOUNCEMENT_ID       RAW(32)       DEFAULT SYS_GUID() NOT NULL,
      4      ANNOUNCEMENT_TITLE    VARCHAR2(100)     NULL,
      5      ANNOUNCEMENT_CONTENT  LONG              NULL,
      6      ANNOUNCEMENT_DATETIME TIMESTAMP(6)  DEFAULT Sysdate     NULL,
      7      ANNOUNCEMENT_AUTHOR   VARCHAR2(20)      NULL
      8  )
      9  ;Table created.SQL> INSERT INTO LACL.ANNOUNCEMENT
          (ANNOUNCEMENT_TITLE,
           ANNOUNCEMENT_CONTENT,
           ANNOUNCEMENT_AUTHOR)
    VALUES
          ('aaa',
           'aaaa',
           'aaaaaa');
      2    3    4    5    6    7    8
    1 row created.SQL> /1 row created.SQL> /1 row created.SQL> SELECT ANNOUNCEMENT_ID FROM LACL.ANNOUNCEMENT;ANNOUNCEMENT_ID
    ----------------------------------------------------------------
    E481CFB5906559CDE03073CA38A96B56
    E481CFB5906659CDE03073CA38A96B56
    E481CFB5906759CDE03073CA38A96B56
    E48432D69A6C1979E03073CA38A975B6
    E48432D69A6D1979E03073CA38A975B6
    E48432D69A6E1979E03073CA38A975B66 rows selected.SQL>
      

  2.   

    事情越来越蹊跷:
    [oracle@lacl-001 oracle]$ sqlplusSQL*Plus: Release 10.1.0.2.0 - Production on Mon Sep 20 19:04:14 2004Copyright (c) 1982, 2004, Oracle.  All rights reserved.Enter user-name: lacl
    Enter password:Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining optionsSQL> select sys_guid() from dual;SYS_GUID()
    --------------------------------
    E48479AD0C675A33E03073CA38A9781FSQL> select sys_guid() from dual;SYS_GUID()
    --------------------------------
    E48479AD0C685A33E03073CA38A9781FSQL> select sys_guid() from dual;SYS_GUID()
    --------------------------------
    E48479AD0C695A33E03073CA38A9781FSQL>
      

  3.   

    老大,你看清爽了没有啊,你生成的SYS_GUID() 每次是不同的(中间的几位)!Oracle装在Windows下时,SYS_GUID()用的是Windows系统中的API函数 CoCreateGUID 生成的,
    装在Unix, Linux下时系统没有现成的API,估计是Oracle内部模拟实现的,所以看起来没有
    那么“随机”,但肯定是不同的。
      

  4.   

    该打该打。我确实该打。唉,老眼昏花啊。oracle也真是的,应该来点‘雪崩’效应啊。
      

  5.   

    drabit(square) ( ),你的机器,是什么版本?什么平台啊?