Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Data load question
Sandeep,
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.
HTH Stephane Faroult
Sandeep Dubey wrote:
>Mike,
>
>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.
>
>Any thoughts?
>
>Thanks
>
>Sandeep
>--
>http://www.freelists.org/webpage/oracle-l
>
>
>
>
>
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Apr 07 2006 - 16:14:55 CDT