Karl about the Oracle Database

Some experiences out of my daily oracle practice

A simple GUID() Generator …

Posted by carl.reitschuster on April 24th, 2007

Hi Reader,

In a posting in  the Oracle Xing Forum Sven Vetter showed a very simple way to write for example a GUID generator Statement with CONNECT BY;

just

SELECT Sys_Guid()
 FROM  Dual
CONNECT BY LEVEL <= 10
;

SQL> SELECT Sys_Guid()
  2    FROM Dual
  3  CONNECT BY LEVEL <= 10;
 
SYS_GUID()
——————————–
2EDF60AEC8A41F7AE040A98C881B4573
2EDF60AEC8A51F7AE040A98C881B4573
2EDF60AEC8A61F7AE040A98C881B4573
2EDF60AEC8A71F7AE040A98C881B4573
2EDF60AEC8A81F7AE040A98C881B4573
2EDF60AEC8A91F7AE040A98C881B4573
2EDF60AEC8AA1F7AE040A98C881B4573
2EDF60AEC8AB1F7AE040A98C881B4573
2EDF60AEC8AC1F7AE040A98C881B4573
2EDF60AEC8AD1F7AE040A98C881B4573
 
10 rows selected
 
SQL>

Impressed?
Karl Reitschuster

NOTE:

As Laurent Schneider mentioned - this is not normal CONNECT BY behavior and should not work at all - it’s a bug. You must use the PRIOR Operator to describe the parent relationship.

 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>