Re: Data load question
- From: Stephane Faroult <sfaroult@xxxxxxxxxxxx>
- To: dubey.sandeep@xxxxxxxxx
- Date: Fri, 07 Apr 2006 23:14:55 +0200
Looks to me that you absolutely want to use a sequence (possibly for further processing). Mike's query does the trick perfectly well. If your sequences already exist, check the current value and add (current value + 1) to the result of the analytical function, then alter them after the load to reset their minimum value to 1 + the maximum pk value in the relevant table.
If your sequences don't exist, just create them AFTER the load and specify their minimum value as 1 + the maximum currently attained.
I assume of course that A doesn't contain values already present in B or C. If this is the case, then ignore present values, do as Mike suggests, and update the old data afterwards. You will get gaps in your sequence numbers but a lot of people live very happy lives with gaps in sequence numbers. Just decorrelate table population and sequences.
Sandeep Dubey wrote:
Thanks for the reply. It does the task. However, I want b.id and c.id as pk. In you example, each innsert will get the same number starting from 1 each time. Challenge to me is how to opulate C.b_id that is referenceing to B.id.
Sandeep -- http://www.freelists.org/webpage/oracle-l