Got this question from a Oracle SQL Developer Data Modeler user recently –

How can we add INSERT statements for our LOOKUP tables when generating DDL from our Data Model?

– very nice person from Portugal

Example, include the data for my LOCATIONS table

This is pretty straightforward:

  1. Open the table in your relational model
  2. In the Scripts section, add the needed code
  3. In same area, specify WHERE to insert the code
  4. Generate the DDL
  5. In DDL options, enable/check the custom script
  6. Click OK, and Enjoy

Here’s what that looks like –

Model and diagram with DDL, no INSERTs πŸ™

I’ve not added anything ‘custom’ at this point, so just what’s described in the model.

Adding the script for my LOCATIONS table

There are 4 tabs, so I’ve selected ‘End of Script’ for my INSERTs to appear.

Generate!

It won’t show up unless you opt to include it, not checked by default.

Enjoy

Since I opted to include the INSERTS at the end of the script, there they appear.

Cool

But wait, why does it look different than what I put in the table properties? It’s almost like, SQL Developer is formatting my SQL…or something.

Yes, that’s controlled here, in the Modeler preferences –

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment