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 DualCONNECT 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.