Code generation

DDL statements

Create/Modify table generation

Press Ctrl+F6 on the table name, either from the database view or directly from the SQL code. You get a window where you can modify the table. Define or change table components like columns, indexes, and constraints. In instant preview you can see the code that is generated. Choose what you want to do: execute it right away or paste it in the editor.

SQL generator

DDL statement for any object

SQL generator helps you to get DDL scripts with options. To do this, press Ctrl+Alt+G or choose Context menu → SQL Scripts → SQL Generator… and get the generated DDL of any kind of object (table, schema, procedure, whatever).

DDL statement for many objects or the whole schema

The same works for many objects and even for the whole schema. Press Ctrl+Alt+G on the schema name and get a script to create all the objects.

Generate SQL files for the selected objects

When you use the SQL Generator Ctrl+Alt+G to get the DDL from objects, you can also generate the SQL files for these objects. To do this, click the save button on the left pane.

There are two layouts for the output. Now you can click the Edit button to the right of the Layout drop-down and edit any of them. Or create your own. These layouts are just groovy scripts.

Generate execution script for procedures

To do this, choose Execute procedures and functions option in Generate

Code snippets for creating objects

The Generate action, available via Alt+Ins, helps you generate and modify DDL statements. If you create a function, procedure, trigger etc. with the Generate action, a DDL snippet will be pasted in the editor. If you create a table, you get the window mentioned above where you define all the table components from the UI: an appropriate DDL statement will be generated.

To learn about DML generation, please see Import/Export options.