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: 65691
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: 958
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: 73
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: 65691
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

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

[Edit: missing letter]

[Updated on: Fri, 17 August 2018 00:20]

Report message to a moderator

Re: Generate DDL using Sql Developer [message #664644 is a reply to message #664637] Tue, 25 July 2017 23:32 Go to previous messageGo to next message
chad_2000
Messages: 23
Registered: February 2017
Junior Member
Thank you so much.
Re: Generate DDL using Sql Developer [message #671209 is a reply to message #664644] Thu, 16 August 2018 16:35 Go to previous message
Sewers
Messages: 1
Registered: August 2018
Junior Member
Good job
Previous Topic: Convert ASCII number 177 to character +/-
Next Topic: PL/SQL Developer settings FAQ
Goto Forum:
  


Current Time: Mon Aug 20 00:32:47 CDT 2018