0

Please tell me how can I move dependencies (such as PK, FK and indexes) from one table to another within the same database in Oracle? The second table is a copy of the first, only created later for partition reasons. Thank you in advance! :)

pswaminathan
  • 8,734
  • 1
  • 20
  • 27
kaileena
  • 119
  • 9
  • What have you tried, where have you looked? More detail about the efforts you have taken will encourage more people to help you out. – pswaminathan May 03 '14 at 23:44

1 Answers1

0

You could look at using the dictionary views in oracle, specifically the USER_CONSTRAINTS view. Then either construct a SQL statement dynamically or use DBMS_METADATA.get_ddl procedure to get the ddl for the constraint. You could do a REPLACE on the SQL to replace the original table name and constraint name with a new constraint name and the name of the new table.

Tomás
  • 535
  • 6
  • 23