Code generation

DDL generation

CREATE table generation

The Generate action, available via Alt+Ins, helps you generate and modify DDL statements. In case you create a table, you get a window where you define all table components like columns, indices and constraints. In instant preview you see the code that is generated. Choose what you want to do—execute it right now or paste it to the editor.

Replacing existing DDL

Another available option is to replace the DDL which is already in your editor. Press Ctrl+F6 when the cursor is inside the DDL, and the IDE will represent it in the same UI, generating this DDL. Choose Replace existing DDL to have your query replaced.

Code generation for modifying objects

Now let's look at generating code for modifying objects that are already in the database. Press Ctrl+F6 on the table name, either from the database view or directly from the SQL code. You get the familiar window where you can modify the table. Notice the drop-down next to the Open in editor option. For instance, if you create a column in the table, choosing Modify existing objects will generate ALTER statement for the edited table, and Creating modified objects will generate the CREATE statement.

When you create database objects from the context menu, you again see the Modify Table window where you can generate the code for creating the index. The drop-down next to the Open in editor option is also important—choose Creating modified objects to get the DDL for creating the index, or choose Creating all objects to generate the whole CREATE DDL for the edited table.

What you can also do is press Alt+Ins n the database view or in the editor and the IDE will offer you to create the table or table component. As usual, choose if you want the object to be created right now or continue working with the generated code.

CREATE procedure/function generation

In case you create a function or procedure with the Generate action, a blank DDL statement will be pasted to the editor.

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