Here's a bit of a doozie
I have written a an sql package to export data from tables owned by a schema entered at run time by the user. The script exports the data to a comma delimeted file this is fine but I have to take referential integrity into consideration and export the data in the order that it needs to be imported back into the database if needed. I know that I need to look at the user_constraints table but does anyone know how I deduce what order I need to export the data, I am only concerned on a table by table situation but I don't know how to see what foreign keys are associated with what tables. Basiccaly the first data written should be the ultimate parent and so on.
Any sugestions at all would be great.