Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create dependency after table was created

Status
Not open for further replies.

lydiattc

Programmer
Jun 3, 2003
52
US
Hi,

I have a set of tables imported from SQL Server to Oracle. During the import process, somehow the dependencies got lost. How do I create the dependencies when tables have already been created?

Thanks,
Tianle
 
Hi,
Please explain further what you mean by dependencies ( Primary Key -> Foreign Key perhaps?)

How was the import done - DTS, Oracle Migration Workbench, ?

[profile]
 
I used the tool in SQL Server, and exported tables to Oracle.

Yes, I meant Primary Key and Foreign Keys. I know I can create them when I create a table, but I don't know how to creat them after the table is already created, and I don't want to drop all talbes and recreate them again.

Thanks.
 
Thanks, Turkbear. I've tried it with alter table command, but it always gave me an error saying "parent keys not found" I've checked the parent key, and it's there. What could be wrong here.

Thanks.
 
This means that your child table contains "orphan" entries (records with no corresponding parents). Read about EXCEPTIONS clause to find them or just run some query like:

select * from child where not exists (select 1 from parent where parent_key=child_key)

Regards, Dima
 
Thanks, Dima. It worked. For some reason, when I exported the tables to Oracle, some of the tables failed to export the data when others succeeded. The export tool is truely not reliable at all.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top