primary and foreign keys problem [message #184501] |
Wed, 26 July 2006 16:53 |
Jolanda
Messages: 68 Registered: September 2004
|
Member |
|
|
I want to thank you all for your input. Actually I should apoligize because I haven't defined the problem area as I should.
The issue here is that data is already in the destination tables. The staging tables are mutations. So, In A way I have to use the primary and foreign keys to find the related records using the primary keys on the staging tables to update the destination tables.
So, what I need to do is (I think), check if the supplied primary keys are unique and find the FK's.
Does anyone know how to accomplish this?
Thanks in advance.
Jolanda.
I have text files which I process with sqlloader into staging tables. This is done and the staging tables are filled. There are no relations between the staging tables. The data in the staging tables should be processed and insert into the destination tables. However, on the destination side, there is ofcourse relationship between the tables. I need to get the data from the staging tables and insert it into the destination tables.
I know which table I should process first and second and go on.
How can I properly use the foreign keys and primary keys to get the related data from the staging tables and insert these into the destination tables without getting constraint errors because of parent-child relations?
Can anyone please help me out with ideas?
I am thinking about looping through the tables, finding the related tables on the destination side, check the foreign keys and primary keys, but actually I'm not pretty sure about how to accomplish this.
I really do hope that someone can help me out!
Thanks in advance
Jolanda
[Updated on: Thu, 27 July 2006 09:08] Report message to a moderator
|
|
|
Re: primary and foreign keys problem [message #184519 is a reply to message #184501] |
Wed, 26 July 2006 19:47 |
shobanasuha
Messages: 2 Registered: July 2006 Location: California
|
Junior Member |
|
|
Since the schema is unknown just give a try...
Better have a good understanding about the destination tables and columns. Match them with the staging tables.Use constraints in staging tables and start inserting. Hope this works out.
|
|
|
|
|