Home » SQL & PL/SQL » Client Tools » Generate DDL using Sql Developer (Oracle 12.1.0.2 ,Windows server 2012 64bit)
Generate DDL using Sql Developer [message #664621] Tue, 25 July 2017 01:29 Go to next message
chad_2000
Messages: 23
Registered: February 2017
Junior Member
Hi,

There is a way for generating tables definition scripts using Oracle SQL Developer(using the "Tools" > "Database Export" menu entry.), but the problem is that the tables are exported in the alphabetical order ( not depending on foreign key constraints - Parent and child tables definition).

How can generate tables,indexes,constraint definition scripts which does not have this issue?
Re: Generate DDL using Sql Developer [message #664623 is a reply to message #664621] Tue, 25 July 2017 02:11 Go to previous messageGo to next message
Michel Cadot
Messages: 65202
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Generate first all tables without constraints then add constraints.

Re: Generate DDL using Sql Developer [message #664624 is a reply to message #664623] Tue, 25 July 2017 02:47 Go to previous messageGo to next message
chad_2000
Messages: 23
Registered: February 2017
Junior Member
Thank you so much for your useful reply.
In the generated script for those tables that have a referenced partition, foreign key constraints are added, despite unchecked constraint at option type selection step.
Re: Generate DDL using Sql Developer [message #664626 is a reply to message #664624] Tue, 25 July 2017 06:23 Go to previous messageGo to next message
EdStevens
Messages: 850
Registered: September 2013
Senior Member
chad_2000 wrote on Tue, 25 July 2017 02:47
Thank you so much for your useful reply.
In the generated script for those tables that have a referenced partition, foreign key constraints are added, despite unchecked constraint at option type selection step.
So what prevents you from taking saving the generated ddl to a file, then editing it to put things in the order that you need?
Re: Generate DDL using Sql Developer [message #664636 is a reply to message #664621] Tue, 25 July 2017 09:03 Go to previous messageGo to next message
thatjeffsmith
Messages: 71
Registered: July 2009
Location: Raleigh, NC
Member

The FK constraints are listed AFTER all the tables, so table order shouldn't matter.
Re: Generate DDL using Sql Developer [message #664637 is a reply to message #664636] Tue, 25 July 2017 10:06 Go to previous messageGo to next message
Michel Cadot
Messages: 65202
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

For the constraints, generate first the rimary key and unique constraints, then the FK.

Re: Generate DDL using Sql Developer [message #664644 is a reply to message #664637] Tue, 25 July 2017 23:32 Go to previous message
chad_2000
Messages: 23
Registered: February 2017
Junior Member
Thank you so much.
Previous Topic: SQL spool file, line gets cutoff at 80 characters
Next Topic: oracle configuration tools to be used for server database connection with client pc
Goto Forum:
  


Current Time: Wed Nov 22 21:44:12 CST 2017

Total time taken to generate the page: 0.02520 seconds