Re: Return multiple copies of same row in table with sequence number

From: Maxim Demenko <>
Date: Sat, 08 Mar 2008 17:45:29 +0100
Message-ID: <> schrieb:
> Maxim:
> I was able to use your solution in my application. Can you explain
> how this works?

To be honest - no, i can't.
You maybe have noticed, that if you leave out the dbms_random.value part, then you get ora-01436 (the sense of this hierarchy is apparently obvious - generate child records for every given employee until level reaches certificatecount). In some way dbms_random makes the connect by query to not consider the previous row exactly the same as current (otherwise you get connect-by loop). I don't think, this is somewhere documented, so you can hardly rely on this behaviour, but it works (and is relatively widely used - at least in some sql related forums/blogs or on OTN). The dbms_random.value can as well be substituted by sys_guid().

Best regards

Maxim Received on Sat Mar 08 2008 - 10:45:29 CST

Original text of this message