Skip to content
The latest version of DbVisualizer was released 2024-07-04DOWNLOAD HERE ->

Getting the DDL for an Object

You can use the @dll command in a script to get the DDL for a number of different database object types. The command supports this general syntax:

@ddl <objType>="<objId>" [ drop="true | false" ] [ constrCtrl="<constrCtrl>" ]

where <objType> is one of table, indexesfortable, view, procedure, function, package (Oracle only), packagebody (Oracle only), objecttype (Oracle only), objecttypebody (Oracle only), sequence (Oracle only), synonym (Oracle only), module (Mimer SQL only) or trigger, and <objId> is the qualified identifier for the object (case sensitive). Here's an example:

@ddl table="SAKILA.STAFF";

If drop is set to true, a DROP statement is included before the CREATE statement.

The constrCtrl parameter only applies to tables. It accepts two values: noconstr means that no constraints should be included in the statement that can potentially cause creating the table or inserting data into it to fail (FK and CHECK constraints), while onlyconstr means that an ALTER statement adding the remaining constraints should be generated instead of a CREATE statement.